ZF-10727: Add additional methods to Zend_Navigation_Page_Mvc for manipulating parameters
Description
I'm giving some static parameters to a page through a navigation xml file ("params" markup) and i'd like to add dynamically others parameter to the same page. In order to do that,i'm using the setParams() method of Zend_Navigation_Page_Mvc class.
Problem: this method erase previous parameters given via xml.
I suggest to merge parameters instead of erase previous ones:
Current listing:
public function setParams(array $params = null)
{
if (null === $params) {
$this->_params = array();
} else {
// TODO: do this more intelligently?
$this->_params = $params;
}
$this->_hrefCache = null;
return $this;
}
with merging:
public function setParams(array $params = null)
{
if (null === $params) {
$this->_params = array();
} else {
// TODO: do this more intelligently?
$this->_params = array_merge($this->_params, $params);
}
$this->_hrefCache = null;
return $this;
}
Workaround: using getParams in my listing to merge parameters with others then using setParams($merged_array)
Comments
Posted by Kai Uwe (kaiuwe) on 2011-04-06T08:29:41.000+0000
My suggestion:
Posted by Frank Brückner (frosch) on 2011-09-22T08:57:47.000+0000
Patch and unit tests added.
Posted by Adam Lundrigan (adamlundrigan) on 2012-06-02T01:33:37.000+0000
Fixed in trunk (1.12.0): r24867