Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LanguageConfigOverride.php

function LanguageConfigOverride::save

Overrides StorableConfigBase::save

File

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

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;
    // Dispatch configuration override event as detailed in
    // \Drupal\Core\Config\ConfigFactoryOverrideInterface::createConfigObject().
    $this->eventDispatcher
        ->dispatch(new ConfigCrudEvent($this), ConfigCollectionEvents::SAVE_IN_COLLECTION);
    // Dispatch an event specifically for language configuration override
    // changes.
    $this->eventDispatcher
        ->dispatch(new LanguageConfigOverrideCrudEvent($this), LanguageConfigOverrideEvents::SAVE_OVERRIDE);
    $this->originalData = $this->data;
    return $this;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal