public MenuLinkTreeElement::count()
Counts all menu links in the current subtree.
int The number of menu links in this subtree (one plus the number of menu links in all descendants).
public function count() { $sum = function($carry, MenuLinkTreeElement $element) { return $carry + $element->count(); }; return 1 + array_reduce($this->subtree, $sum); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Menu!MenuLinkTreeElement.php/function/MenuLinkTreeElement::count/8.1.x