ConfigFactoryOverrideBase::filterOverride

protected ConfigFactoryOverrideBase::filterOverride(Config $config, StorableConfigBase $override)

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.

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);
  }
}
doc_Drupal
2016-10-29 08:53:18
Comments
Leave a Comment

Please login to continue.