LanguageConfigOverride::save

public LanguageConfigOverride::save($has_trusted_data = FALSE)

Saves the configuration object.

Must invalidate the cache tags associated with the configuration object.

Parameters

bool $has_trusted_data: Set to TRUE if the configuration data has already been checked to ensure it conforms to schema. Generally this is only used during module and theme installation.

Return value

$this

Overrides StorableConfigBase::save

See also

\Drupal\Core\Config\ConfigInstaller::createConfiguration()

File

core/modules/language/src/Config/LanguageConfigOverride.php, line 48

Class

LanguageConfigOverride
Defines language configuration overrides.

Namespace

Drupal\language\Config

Code

public function save($has_trusted_data = FALSE) {
  if (!$has_trusted_data) {
    // @todo Use configuration schema to validate.
    //   https://www.drupal.org/node/2270399
    // Perform basic data validation.
    foreach ($this->data as $key => $value) {
      $this->validateValue($key, $value);
    }
  }

  $this->storage->write($this->name, $this->data);
  // Invalidate the cache tags not only when updating, but also when creating,
  // because a language config override object uses the same cache tag as the
  // default configuration object. Hence creating a language override is like
  // an update of configuration, but only for a specific language.
  Cache::invalidateTags($this->getCacheTags());
  $this->isNew = FALSE;
  $this->eventDispatcher->dispatch(LanguageConfigOverrideEvents::SAVE_OVERRIDE, new LanguageConfigOverrideCrudEvent($this));
  $this->originalData = $this->data;
  return $this;
}
doc_Drupal
2016-10-29 09:22:12
Comments
Leave a Comment

Please login to continue.