ZF-11413: Zend_Navigation_Page_Mvc isActive doesn't check for route default params (module, controller, action) but rather to default params for the application
Description
Hello,
Zend_Navigation_Page_Mvc is not looking for page route default params but rather for the default application module/controller/action.
The isActive function is checking at application level, and not at the page route level for the default params...
The sequence is from Zend_Navigation_Page_Mvc class, starting with line 141:
if (null !== $this->_module) {
$myParams['module'] = $this->_module;
} else {
$myParams['module'] = $front->getDefaultModule();
}
if (null !== $this->_controller) {
$myParams['controller'] = $this->_controller;
} else {
$myParams['controller'] = $front->getDefaultControllerName();
}
if (null !== $this->_action) {
$myParams['action'] = $this->_action;
} else {
$myParams['action'] = $front->getDefaultAction();
}
Sample case below.
Route
$type = new Application_Controller_Router_Route_Type(
':action/:page/*',
array('module'=>'resources', 'controller'=>'types', 'page'=>1),
array('action' => 'news|reports|articles', 'page'=>'\d+')
);
For the mvc page defined as :
array(
'label' => 'My News',
'action' => 'news',
'route'=>'type',
'title' => 'My News'
)
The isActive resolves the page to params: default/index/news !!! instead of resources/types/news, as should be based on the route default params...
Comments
Posted by Cristian Bichis (avantis) on 2011-05-26T13:52:19.000+0000
Some more comments: 1. A test url would be: /news 2. The type route is added after the default route
Posted by Kim Blomqvist (kblomqvist) on 2011-05-26T14:18:39.000+0000
Is this related to ZF-11359?
Posted by Cristian Bichis (avantis) on 2011-05-26T14:21:35.000+0000
Hi Kim,
It seems to be related.
Seems a solution already exists, is just waiting for someone to commit...
Posted by Kai Uwe (kaiuwe) on 2011-05-26T14:44:15.000+0000
@Cristian You are right.