You are here

public function WeMegaMenuAdminController::configWeMegaMenu in Drupal Mega Menu 8.x

Same name and namespace in other branches
  1. 8 src/Controller/WeMegaMenuAdminController.php \Drupal\we_megamenu\Controller\WeMegaMenuAdminController::configWeMegaMenu()

A function build page backend.

Parameters

string $menu_name: Public function configWeMegaMenu menu_name.

Return value

array[markup] Public function configWeMegaMenu string.

1 string reference to 'WeMegaMenuAdminController::configWeMegaMenu'
we_megamenu.routing.yml in ./we_megamenu.routing.yml
we_megamenu.routing.yml

File

src/Controller/WeMegaMenuAdminController.php, line 63

Class

WeMegaMenuAdminController
Controller routines for block example routes.

Namespace

Drupal\we_megamenu\Controller

Code

public function configWeMegaMenu($menu_name) {

  // $tree = WeMegaMenuBuilder::getMenuTreeOrder($menu_name);
  $build = [];
  $build['we_megamenu'] = [
    '#theme' => 'we_megamenu_backend',
    '#menu_name' => $menu_name,
    // '#items' => $tree,
    '#blocks' => WeMegaMenuBuilder::getAllBlocks(),
    '#block_theme' => $this->configFactory
      ->get('system.theme')
      ->get('default'),
  ];
  $build['we_megamenu']['#attached']['library'][] = 'we_megamenu/form.we-mega-menu-backend';
  $abs_url_save_config = Url::fromRoute('we_megamenu.admin.save', [], [
    'absolute' => TRUE,
  ])
    ->toString();
  $abs_url_reset_config = Url::fromRoute('we_megamenu.admin.reset', [], [
    'absolute' => TRUE,
  ])
    ->toString();
  $abs_url_icons_config = Url::fromRoute('we_megamenu.geticons', [], [
    'absolute' => TRUE,
  ])
    ->toString();
  $build['#attached']['drupalSettings']['WeMegaMenu']['saveConfigWeMegaMenuURL'] = $abs_url_save_config;
  $build['#attached']['drupalSettings']['WeMegaMenu']['resetConfigWeMegaMenuURL'] = $abs_url_reset_config;
  $build['#attached']['drupalSettings']['WeMegaMenu']['iconsWeMegaMenuURL'] = $abs_url_icons_config;
  return $build;
}