You are here

public function TBMegaMenuBuilder::syncConfigAll in The Better Mega Menu 2.x

Same name and namespace in other branches
  1. 8 src/TBMegaMenuBuilder.php \Drupal\tb_megamenu\TBMegaMenuBuilder::syncConfigAll()

Add item config values to menu config array.

Parameters

array $menu_items: The menu tree for this config.

array $menu_config: The menu configuration.

string $section: The menu section.

Overrides TBMegaMenuBuilderInterface::syncConfigAll

File

src/TBMegaMenuBuilder.php, line 302

Class

TBMegaMenuBuilder
Defines a TBMegaMenuBuilder.

Namespace

Drupal\tb_megamenu

Code

public function syncConfigAll(array $menu_items, array &$menu_config, string $section) {
  foreach ($menu_items as $id => $menu_item) {
    $item_config = isset($menu_config[$id]) ? $menu_config[$id] : [];
    if ($menu_item->hasChildren || $item_config) {
      self::syncConfig($menu_item->subtree, $item_config, $section);
      $menu_config[$id] = $item_config;
      self::syncConfigAll($menu_item->subtree, $menu_config, $section);
    }
  }
}