You are here

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

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

Set the default values to configuration in TB Megamenu item if it's empty.

Parameters

array $item_config: The array to fill with default values.

Overrides TBMegaMenuBuilderInterface::editItemConfig

File

src/TBMegaMenuBuilder.php, line 172

Class

TBMegaMenuBuilder
Defines a TBMegaMenuBuilder.

Namespace

Drupal\tb_megamenu

Code

public function editItemConfig(array &$item_config) {
  $attributes = [
    'xicon' => '',
    'class' => '',
    'caption' => '',
    'alignsub' => '',
    'group' => 0,
    'hidewcol' => 0,
    'hidesub' => 0,
  ];
  foreach ($attributes as $attribute => $value) {
    if (!isset($item_config[$attribute])) {
      $item_config[$attribute] = $value;
    }
  }
}