You are here

public function MegaMenuConfig::getMenuConfig in The Better Mega Menu 8

Same name and namespace in other branches
  1. 2.x src/Entity/MegaMenuConfig.php \Drupal\tb_megamenu\Entity\MegaMenuConfig::getMenuConfig()

Overrides MegaMenuConfigInterface::getMenuConfig

See also

\Drupal\tb_megamenu\MegaMenuConfigInterface::getMenuConfig()

File

src/Entity/MegaMenuConfig.php, line 136

Class

MegaMenuConfig
Defines the Mega Menu Configuration entity.

Namespace

Drupal\tb_megamenu\Entity

Code

public function getMenuConfig() {
  if (is_array($this->menu_config)) {
    $this
      ->setMenuConfig($this->menu_config);
    \Drupal::logger('tb_megamenu')
      ->info("Converted menu config array to json string.");
  }
  $config = isset($this->menu_config) ? Json::decode($this->menu_config) : [];
  if ($config === NULL) {
    \Drupal::logger('tb_megamenu')
      ->warning("Could not decode menu config json string for @id", [
      '@id' => $this->id,
    ]);
    $config = [];
  }
  return $config;
}