You are here

public static function WeMegaMenuBuilder::countMegamenuSubItem in Drupal Mega Menu 8

Same name and namespace in other branches
  1. 8.x src/WeMegaMenuBuilder.php \Drupal\we_megamenu\WeMegaMenuBuilder::countMegamenuSubItem()
1 call to WeMegaMenuBuilder::countMegamenuSubItem()
WeMegaMenuBuilder::compareItem in src/WeMegaMenuBuilder.php

File

src/WeMegaMenuBuilder.php, line 748

Class

WeMegaMenuBuilder

Namespace

Drupal\we_megamenu

Code

public static function countMegamenuSubItem($menu_config, $derivativeId) {
  if (!isset($menu_config[$derivativeId])) {
    return 0;
  }
  $megamenu_item = $menu_config[$derivativeId];
  $count = 0;
  foreach ($megamenu_item['rows_content'] as $i => $cols) {
    foreach ($cols as $j => $col) {
      $count += isset($col['col_content']) ? count($col['col_content']) : 0;
    }
  }
  return $count;
}