protected function StaticMenuLinkOverrides::getConfig

protected 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 54

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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Menu!StaticMenuLinkOverrides.php/function/StaticMenuLinkOverrides::getConfig/8.1.x