Skip to content

Instantly share code, notes, and snippets.

@gbili
Created April 6, 2013 14:20
Show Gist options
  • Save gbili/5326266 to your computer and use it in GitHub Desktop.
Save gbili/5326266 to your computer and use it in GitHub Desktop.
AbstractContainer Trying to get all the branch of the current active page (all parent pages too)
<?php
class Zend\Navigation\AbstractContainer
...
public function getActiveBranch()
{
$found = array();
$iterator = new RecursiveIteratorIterator($this, RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $page) {
if ($page->isActive(true)) {
$found[] = $page;
}
}
return $found;
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment