Zend_Navigation-Migration.xml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.navigation.migration">
  4. <title>Migrating from Previous Versions</title>
  5. <para>
  6. This chapter documents primarily backwards compatibility breaks made in
  7. <classname>Zend_Navigation</classname> and <classname>Zend_View_Helper_Navigation</classname>, and should serve to aid
  8. in migration from previous versions.
  9. </para>
  10. <sect2 id="zend.view.navigation.zf7341">
  11. <title>Migrating from versions prior to 1.9</title>
  12. <para>
  13. Prior to the 1.9 release, the menu helper
  14. (<classname>Zend_View_Helper_Navigation_Menu</classname>) did not
  15. render sub menus correctly. When the <code>onlyActiveBranch</code>
  16. was <constant>TRUE</constant> and the option <code>renderParents</code>
  17. <constant>FALSE</constant>, nothing would be rendered if the deepest active
  18. page was at a depth lower than the <code>minDepth</code> option.
  19. </para>
  20. <para>
  21. In simpler words; if <code>minDepth</code> was set to <code>1</code>
  22. and the active page was at one of the first level pages, nothing
  23. would be rendered, as the following example shows.
  24. </para>
  25. <para>
  26. Consider the following container setup:
  27. </para>
  28. <programlisting language="php"><![CDATA[
  29. <?php
  30. $container = new Zend_Navigation(array(
  31. array(
  32. 'label' => 'Home',
  33. 'uri' => '#'
  34. ),
  35. array(
  36. 'label' => 'Products',
  37. 'uri' => '#',
  38. 'active' => true,
  39. 'pages' => array(
  40. array(
  41. 'label' => 'Server',
  42. 'uri' => '#'
  43. ),
  44. array(
  45. 'label' => 'Studio',
  46. 'uri' => '#'
  47. )
  48. )
  49. ),
  50. array(
  51. 'label' => 'Solutions',
  52. 'uri' => '#'
  53. )
  54. ));
  55. ]]></programlisting>
  56. <para>
  57. The following code is used in a view script:
  58. </para>
  59. <programlisting language="php"><![CDATA[
  60. <?php echo $this->navigation()->menu()->renderMenu($container, array(
  61. 'minDepth' => 1,
  62. 'onlyActiveBranch' => true,
  63. 'renderParents' => false
  64. )); ?>
  65. ]]></programlisting>
  66. <para>
  67. Before release 1.9, the code snippet above would output nothing.
  68. </para>
  69. <para>
  70. Since release 1.9, the <methodname>_renderDeepestMenu()</methodname> method in
  71. <classname>Zend_View_Helper_Navigation_Menu</classname> will accept
  72. active pages at one level below <code>minDepth</code>, as long as
  73. the page has children.
  74. </para>
  75. <para>
  76. The same code snippet will now output the following:
  77. </para>
  78. <programlisting language="html"><![CDATA[
  79. <ul class="navigation">
  80. <li>
  81. <a href="#">Server</a>
  82. </li>
  83. <li>
  84. <a href="#">Studio</a>
  85. </li>
  86. </ul>
  87. ]]></programlisting>
  88. </sect2>
  89. </sect1>