function LenientConfigSchemaChecker::onConfigSave

Checks that configuration complies with its schema on config save.

Parameters

\Drupal\Core\Config\ConfigCrudEvent $event: The configuration event.

File

core/lib/Drupal/Core/Config/Development/LenientConfigSchemaChecker.php, line 38

Class

LenientConfigSchemaChecker
Listens to the config save event and warns about invalid schema.

Namespace

Drupal\Core\Config\Development

Code

public function onConfigSave(ConfigCrudEvent $event) : void {
    try {
        parent::onConfigSave($event);
    } catch (SchemaIncompleteException $exception) {
        $message = sprintf('%s. These errors mean there is configuration that does not comply with its schema. This is not a fatal error, but it is recommended to fix these issues. For more information on configuration schemas, check out <a href="%s">the documentation</a>.', $exception->getMessage(), 'https://www.drupal.org/docs/drupal-apis/configuration-api/configuration-schemametadata');
        $this->messenger
            ->addWarning($message);
        $this->logger
            ->warning($message);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.