//in a template
$this->Html->link('Destination', $params);
//or in a general sense
Router::url($params);
I’m having a specific failure though. The pass values are not in the resulting url string.
Details about the structure
The params array carries the pass values on the pass node. If I move these values into the first level of the params array I an get the url string result I expect.
I fiddled with writing a route to correct this… I’m not clear on the concepts in the Router and can’t give you specifics because I literally spent 2 hours trying every variation I could think of.
Conclusion
What am I not getting? Are params arrays not supposed to work like this?
That code fails to include any existing pass params in the url. And in the case of index will not include the action (the detail that made me think it might be a routes problem).
$url = $this->getRequest()->getAttribute('params');
//change the array to move any pass params up one level
$pass = $url['pass'];
$url = $url + $pass;
/* prepare url for Inactive */
$url = Hash::insert($url, '?.active', 0);
echo $this->Html->link(
__('Inactive'),
$url,
['class' => 'button button-outline float-right']);
I’m not trying to build the ‘pass’. It already exists as part of the params and I have to un-build it to get the result I want. This is the core of my question. It feels like the params array should both produce and be produced by the url with no modifications necessary.