class LenientConfigSchemaChecker

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

Hierarchy

Expanded class hierarchy of LenientConfigSchemaChecker

2 string references to 'LenientConfigSchemaChecker'
development.services.yml in sites/development.services.yml
sites/development.services.yml
development.services.yml in core/assets/scaffold/files/development.services.yml
core/assets/scaffold/files/development.services.yml
2 services use LenientConfigSchemaChecker
config.schema_checker in sites/development.services.yml
Drupal\Core\Config\Development\LenientConfigSchemaChecker
config.schema_checker in core/assets/scaffold/files/development.services.yml
Drupal\Core\Config\Development\LenientConfigSchemaChecker

File

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

Namespace

Drupal\Core\Config\Development
View source
class LenientConfigSchemaChecker extends ConfigSchemaChecker {
    
    /**
     * Constructs the ConfigSchemaChecker object.
     *
     * @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_manager
     *   The typed config manager.
     * @param \Drupal\Core\Messenger\MessengerInterface $messenger
     *   The messenger service to display the warning.
     * @param \Psr\Log\LoggerInterface $logger
     *   The logger to save the warning.
     * @param string[] $exclude
     *   An array of config object names that are excluded from schema checking.
     */
    public function __construct(TypedConfigManagerInterface $typed_manager, MessengerInterface $messenger, LoggerInterface $logger, array $exclude = []) {
        parent::__construct($typed_manager, $exclude);
    }
    
    /**
     * Checks that configuration complies with its schema on config save.
     *
     * @param \Drupal\Core\Config\ConfigCrudEvent $event
     *   The configuration event.
     */
    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);
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
ConfigSchemaChecker::$checked protected property An array of config checked already. Keyed by config name and a checksum.
ConfigSchemaChecker::$exclude protected property An array of config object names that are excluded from schema checking.
ConfigSchemaChecker::$typedManager protected property The typed config manger.
ConfigSchemaChecker::getSubscribedEvents public static function
LenientConfigSchemaChecker::onConfigSave public function Checks that configuration complies with its schema on config save. Overrides ConfigSchemaChecker::onConfigSave
LenientConfigSchemaChecker::__construct public function Constructs the ConfigSchemaChecker object. Overrides ConfigSchemaChecker::__construct
SchemaCheckTrait::$configName protected property The configuration object name under test.
SchemaCheckTrait::$ignoredPropertyPaths protected static property The ignored property paths.
SchemaCheckTrait::$schema protected property The config schema wrapper object for the configuration object under test.
SchemaCheckTrait::checkConfigSchema public function Checks the TypedConfigManager has a valid schema for the configuration.
SchemaCheckTrait::checkValue protected function Helper method to check data type.
SchemaCheckTrait::isViolationForIgnoredPropertyPath protected static function Determines whether this violation is for an ignored Config property path.

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