public static function WeMegaMenuBuilder::sortMenuDeep in Drupal Mega Menu 8
Same name and namespace in other branches
- 8.x src/WeMegaMenuBuilder.php \Drupal\we_megamenu\WeMegaMenuBuilder::sortMenuDeep()
Sort list child menu.
Parameters
string $menu: Public static function sortMenuDeep menu.
Return value
array Public static function sortMenuDeep array.
1 call to WeMegaMenuBuilder::sortMenuDeep()
- WeMegaMenuBuilder::getMenuTreeOrder in src/
WeMegaMenuBuilder.php - Get menu tree sorted by weight ascending.
File
- src/
WeMegaMenuBuilder.php, line 110
Class
Namespace
Drupal\we_megamenuCode
public static function sortMenuDeep($menu) {
if (is_array($menu)) {
$menu = self::sortMenu($menu);
foreach ($menu as $key_item => $item) {
if (isset($item['subtree'])) {
$menu[$key_item]['subtree'] = self::sortMenuDeep($item['subtree']);
}
}
return $menu;
}
return [];
}