There is a method isActive()
in Zend_Navigation
. But it returns true for all the elements in the current path
(parent li
is active and all the children too, even when the current is parent li
).
Is there any method like isCurrent()
, to determine whether the current menu item is the current page?
I just like to add custom class attribute to just one, current element in the whole nested tree of ul's and li's.
easier with:
$activeElement = $view->navigation()->findOneBy('active', 1);
if you're inside your view script you can use:
$activeElement = $this->navigation()->findOneBy('active', 1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With