function ConfigFactoryOverrideBase::filterOverride

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

Filters data in the override based on what is currently in configuration.

Parameters

\Drupal\Core\Config\Config $config: Current configuration object.

\Drupal\Core\Config\StorableConfigBase $override: Override object corresponding to the configuration to filter data in.

1 call to ConfigFactoryOverrideBase::filterOverride()
LanguageConfigFactoryOverride::onConfigSave in core/modules/language/src/Config/LanguageConfigFactoryOverride.php
Actions to be performed to configuration override on configuration save.

File

core/lib/Drupal/Core/Config/ConfigFactoryOverrideBase.php, line 63

Class

ConfigFactoryOverrideBase
Defines a base event listener implementation configuration overrides.

Namespace

Drupal\Core\Config

Code

protected function filterOverride(Config $config, StorableConfigBase $override) {
    $override_data = $override->get();
    $changed = $this->filterNestedArray($config->get(), $override_data);
    if (empty($override_data)) {
        // If no override values are left that would apply, remove the override.
        $override->delete();
    }
    elseif ($changed) {
        // Otherwise set the filtered override values back.
        $override->setData($override_data)
            ->save(TRUE);
    }
}

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