Documentation

Zend Framework 1.12 - Zend Framework Migration Notes

Zend Framework 1.12

When upgrading from a previous release to Zend Framework 1.12 or higher you should note the following migration notes.

Zend_View_Helper_Navigation

Prior to the 1.12 release, a helper with the name "My_View_Helper_Navigation_Menu" can not be used, because the proxy helper returns always the standard view helper "Zend_View_Helper_Navigation_Menu".

Starting from version 1.12, you can use our own navigation helpers with the name "menu", "breadcrumbs", ...

Create your own helper with name "Menu":

  1. class My_View_Helper_Navigation_Menu
  2.     extends Zend_View_Helper_Navigation_HelperAbstract
  3. {
  4.     public function menu(Zend_Navigation_Container $container = null)
  5.     {
  6.         if (null !== $container) {
  7.             $this->setContainer($container);
  8.         }
  9.  
  10.         return $this;
  11.     }
  12.  
  13.     public function render(Zend_Navigation_Container $container = null)
  14.     {
  15.         return '<nav>Example</nav>';
  16.     }
  17. }

Add the helper path to Zend_View in your Bootstrap class:

  1. protected function _initView()
  2.     {
  3.         $this->bootstrap('view');
  4.         $this->view->addHelperPath(
  5.             'path/to/helper',
  6.             'My_View_Helper_Navigation'
  7.         );
  8.     }

Or add the helper path in your "application.ini" file:

  1. resources.view.helperPath.My_View_Helper_Navigation = "path/to/helper"

The following code is used in a view script:

  1. <?php echo $this->navigation()->menu(); ?>

Output:

  1. <nav>Example</nav>

Copyright

© 2006-2021 by Zend by Perforce. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts