diff --git a/core/lib/Drupal/Core/Config/Config.php b/core/lib/Drupal/Core/Config/Config.php index 7deb664..439850e 100644 --- a/core/lib/Drupal/Core/Config/Config.php +++ b/core/lib/Drupal/Core/Config/Config.php @@ -55,11 +55,6 @@ class Config extends StorableConfigBase { protected $settingsOverrides; /** - * @var bool - */ - protected $trustedData = FALSE; - - /** * Constructs a configuration object. * * @param string $name @@ -311,16 +306,4 @@ public function getOriginal($key = '', $apply_overrides = TRUE) { } } - /** - * Indicates that the configuration data is trusted. - * - * If the configuration data is trusted then we don't need to check schema on - * save. - * - * @return $this - */ - public function setTrustedData() { - $this->trustedData = TRUE; - return $this; - } } diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index bc49874..6f692dd 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -581,7 +581,7 @@ public function getTrustedData() { */ public function save() { $return = parent::save(); - $this->setTrustedData(FALSE); + $this->trustedData = FALSE; return $return; } diff --git a/core/lib/Drupal/Core/Config/StorableConfigBase.php b/core/lib/Drupal/Core/Config/StorableConfigBase.php index 4af470e..a25cec4 100644 --- a/core/lib/Drupal/Core/Config/StorableConfigBase.php +++ b/core/lib/Drupal/Core/Config/StorableConfigBase.php @@ -64,6 +64,11 @@ protected $originalData = array(); /** + * @var bool + */ + protected $trustedData = FALSE; + + /** * Saves the configuration object. * * Must invalidate the cache tags associated with the configuration object. @@ -219,4 +224,17 @@ protected function castValue($key, $value) { return $value; } + /** + * Indicates that the configuration data is trusted. + * + * If the configuration data is trusted then we don't need to check schema on + * save. + * + * @return $this + */ + public function setTrustedData() { + $this->trustedData = TRUE; + return $this; + } + } diff --git a/core/modules/book/config/install/node.type.book.yml b/core/modules/book/config/install/node.type.book.yml index 1a5cc16..a5076b2 100644 --- a/core/modules/book/config/install/node.type.book.yml +++ b/core/modules/book/config/install/node.type.book.yml @@ -1,6 +1,8 @@ langcode: en status: true dependencies: + module: + - book enforced: module: - book diff --git a/core/modules/language/src/Config/LanguageConfigOverride.php b/core/modules/language/src/Config/LanguageConfigOverride.php index 5be48ad..a1f7f31 100644 --- a/core/modules/language/src/Config/LanguageConfigOverride.php +++ b/core/modules/language/src/Config/LanguageConfigOverride.php @@ -51,13 +51,15 @@ public function __construct($name, StorageInterface $storage, TypedConfigManager * {@inheritdoc} */ public function save() { - // @todo Use configuration schema to validate. - // https://drupal.org/node/2270399 - // Perform basic data validation. - foreach ($this->data as $key => $value) { - $this->validateValue($key, $value); + if (!$this->trustedData) { + // @todo Use configuration schema to validate. + // https://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); } - $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 @@ -66,6 +68,7 @@ public function save() { $this->isNew = FALSE; $this->eventDispatcher->dispatch(LanguageConfigOverrideEvents::SAVE_OVERRIDE, new LanguageConfigOverrideCrudEvent($this)); $this->originalData = $this->data; + $this->trustedData = FALSE; return $this; } diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php index 1d3c8be..cb1d321 100644 --- a/core/modules/views_ui/src/ViewUI.php +++ b/core/modules/views_ui/src/ViewUI.php @@ -11,6 +11,7 @@ use Drupal\Component\Utility\Html; use Drupal\Component\Utility\Timer; use Drupal\Component\Utility\Xss; +use Drupal\Core\Config\Entity\ConfigEntityInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; use Drupal\views\Views; @@ -1252,4 +1253,18 @@ public function isInstallable() { return $this->storage->isInstallable(); } + /** + * {@inheritdoc} + */ + public function setTrustedData() { + return $this->storage->setTrustedData(); + } + + /** + * {@inheritdoc} + */ + public function getTrustedData() { + return $this->storage->getTrustedData(); + } + }