You are here

protected function StaticMenuLinkOverrides::getConfig in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Menu/StaticMenuLinkOverrides.php \Drupal\Core\Menu\StaticMenuLinkOverrides::getConfig()

Gets the configuration object when needed.

Since this service is injected into all static menu link objects, but only used when updating one, avoid actually loading the config when it's not needed.

File

core/lib/Drupal/Core/Menu/StaticMenuLinkOverrides.php, line 59
Contains \Drupal\Core\Menu\StaticMenuLinkOverrides.

Class

StaticMenuLinkOverrides
Defines an implementation of the menu link override using a config file.

Namespace

Drupal\Core\Menu

Code

protected function getConfig() {
  if (empty($this->config)) {

    // Get an override free and editable configuration object.
    $this->config = $this->configFactory
      ->getEditable($this->configName);
  }
  return $this->config;
}