You are here

public static function WeMegaMenuBuilder::initMegamenu in Drupal Mega Menu 8.x

Same name and namespace in other branches
  1. 8 src/WeMegaMenuBuilder.php \Drupal\we_megamenu\WeMegaMenuBuilder::initMegamenu()
3 calls to WeMegaMenuBuilder::initMegamenu()
template_preprocess_we_megamenu_backend in ./we_megamenu.module
template_preprocess_we_megamenu_frontend in ./we_megamenu.module
Prepare variables for we_megamenu_frontend.
WeMegaMenuAdminController::resetConfigWeMegaMenu in src/Controller/WeMegaMenuAdminController.php
A function reset menu config.

File

src/WeMegaMenuBuilder.php, line 965

Class

WeMegaMenuBuilder

Namespace

Drupal\we_megamenu

Code

public static function initMegamenu($menu_name, $theme_name) {
  $megamenu_config = new \stdClass();
  $megamenu_config->menu_update_flag = 0;
  $megamenu_config->menu_config = new \stdClass();
  $megamenu_config->block_config = [
    'style' => 'Default',
    'animation' => 'None',
    'delay' => '',
    'duration' => '',
    'auto-arrow' => '',
    'always-show-submenu' => '',
    'action' => 'hover',
    'auto-mobile-collapse' => 0,
  ];
  $menu_items = WeMegaMenuBuilder::getMenuTreeOrder($menu_name, FALSE);
  self::updateMegamenuFromDrupalMenu($megamenu_config, $menu_items, 0);
  self::saveConfig($menu_name, $theme_name, json_encode($megamenu_config));
  return $megamenu_config;
}