class ConfigGlobalOverrideSubscriber

Defines a configuration global override for contexts.

Hierarchy

Expanded class hierarchy of ConfigGlobalOverrideSubscriber

1 string reference to 'ConfigGlobalOverrideSubscriber'
core.services.yml in drupal/core/core.services.yml
drupal/core/core.services.yml

File

drupal/core/lib/Drupal/Core/EventSubscriber/ConfigGlobalOverrideSubscriber.php, line 17
Contains \Drupal\Core\EventSubscriber\ConfigGlobalOverrideSubscriber.

Namespace

Drupal\Core\EventSubscriber
View source
class ConfigGlobalOverrideSubscriber implements EventSubscriberInterface {

  /**
   * Overrides configuration values with values in global $conf variable.
   *
   * @param \Drupal\Core\Config\ConfigEvent $event
   *   The Event to process.
   */
  public function configInit(ConfigEvent $event) {
    global $conf;
    $config = $event
      ->getConfig();
    if (isset($conf[$config
      ->getName()])) {
      $config
        ->setOverride($conf[$config
        ->getName()]);
    }
  }

  /**
   * Implements EventSubscriberInterface::getSubscribedEvents().
   */
  static function getSubscribedEvents() {
    $events['config.init'][] = array(
      'configInit',
      30,
    );
    return $events;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigGlobalOverrideSubscriber::configInit public function Overrides configuration values with values in global $conf variable.
ConfigGlobalOverrideSubscriber::getSubscribedEvents static function Implements EventSubscriberInterface::getSubscribedEvents(). Overrides EventSubscriberInterface::getSubscribedEvents