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

Some more comments: 1. A test url would be: /news 2. The type route is added after the default route

Is this related to ZF-11359?

Hi Kim,

It seems to be related.

Seems a solution already exists, is just waiting for someone to commit...

@Cristian You are right.