/**
  * Filters data in the override based on what is currently in configuration.
  *
  * @param \Drupal\Core\Config\Config $config
  *   Current configuration object.
  * @param \Drupal\Core\Config\StorableConfigBase $override
  *   Override object corresponding to the configuration to filter data in.
  */
 protected function filterOverride(Config $config, StorableConfigBase $override)
 {
     $override_data = $override->get();
     $this->filterNestedArray($config->get(), $override_data);
     if (empty($override_data)) {
         // If no override values are left that would apply, remove the override.
         $override->delete();
     } else {
         // Otherwise set the filtered override values back.
         $override->setData($override_data)->save();
     }
 }
Esempio n. 2
0
 /**
  * Update locale storage based on configuration translations.
  *
  * @param \Drupal\Core\Config\StorableConfigBase $config
  *   Active configuration or configuration translation override.
  * @param string $langcode
  *   The language code of $config.
  * @param array $reference_config
  *   (Optional) Reference configuration to check against if $config was an
  *   override. This allows us to update locale keys for data not in the
  *   override but still in the active configuration.
  */
 protected function updateLocaleStorage(StorableConfigBase $config, $langcode, array $reference_config = array())
 {
     $name = $config->getName();
     if ($this->localeConfigManager->isSupported($name) && locale_is_translatable($langcode)) {
         $translatables = $this->localeConfigManager->getTranslatableDefaultConfig($name);
         $this->processTranslatableData($name, $config->get(), $translatables, $langcode, $reference_config);
     }
 }