You are here

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

Same name and namespace in other branches
  1. 8 src/WeMegaMenuBuilder.php \Drupal\we_megamenu\WeMegaMenuBuilder::loadConfig()

Load config Drupal 8 Mega Menu.

Parameters

string $menu_name: Public static function loadConfig menu_name.

string $theme: Public static function loadConfig theme.

Return value

string || bool Public static function loadConfig string.

6 calls to WeMegaMenuBuilder::loadConfig()
template_preprocess_we_megamenu_backend in ./we_megamenu.module
template_preprocess_we_megamenu_frontend in ./we_megamenu.module
Prepare variables for we_megamenu_frontend.
template_preprocess_we_megamenu_li in ./we_megamenu.module
Prepare variables for we_megamenu_li.
we_megamenu_entity_delete in ./we_megamenu.module
Implements hook_entity_delete().
we_megamenu_entity_insert in ./we_megamenu.module
Implements hook_entity_insert().

... See full list

File

src/WeMegaMenuBuilder.php, line 301

Class

WeMegaMenuBuilder

Namespace

Drupal\we_megamenu

Code

public static function loadConfig($menu_name = '', $theme = '') {
  if (!empty($menu_name)) {
    $query = Drupal::database()
      ->select('we_megamenu', 'km');
    $query
      ->addField('km', 'data_config');
    $query
      ->condition('km.menu_name', $menu_name);
    $query
      ->range(0, 1);
    $result = $query
      ->execute()
      ->fetchField();
    return json_decode($result);
  }
  return FALSE;
}