function ConfigModuleOverridesEvent::setOverride

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php \Drupal\Core\Config\ConfigModuleOverridesEvent::setOverride()
  2. 10 core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php \Drupal\Core\Config\ConfigModuleOverridesEvent::setOverride()
  3. 11.x core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php \Drupal\Core\Config\ConfigModuleOverridesEvent::setOverride()

Sets a configuration override for the given name.

Parameters

string $name: The configuration object name to override.

array $values: The values in the configuration object to override.

Return value

$this

File

core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php, line 89

Class

ConfigModuleOverridesEvent
Event object to allow configuration to be overridden by modules.

Namespace

Drupal\Core\Config

Code

public function setOverride($name, array $values) {
    if (in_array($name, $this->names)) {
        if (isset($this->overrides[$name])) {
            // Existing overrides take precedence since these will have been added
            // by events with a higher priority.
            $this->overrides[$name] = NestedArray::mergeDeepArray([
                $values,
                $this->overrides[$name],
            ], TRUE);
        }
        else {
            $this->overrides[$name] = $values;
        }
    }
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.