function ConfigUpdateSubscriber::onConfigSave

Constructs an object.

Parameters

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

File

modules/ctools_entity_mask/tests/modules/entity_mask_test/src/EventSubscriber/ConfigUpdateSubscriber.php, line 21

Class

ConfigUpdateSubscriber
Updates the configuration data at Runtime.

Namespace

Drupal\entity_mask_test\EventSubscriber

Code

public function onConfigSave(ConfigCrudEvent $event) {
  if (!class_exists(DeprecationHelper::class)) {
    return;
  }
  $saved_config = $event->getConfig();
  // The revision field type of `block_content.type.*` is updated to boolean
  // from Drupal Core 10.3.x. So, we are updating the configuration
  // `block_content.type.basic` at runtime, so that `ConfigSchemaChecker`
  // event doesn't throw exceptions in Drupal 10.3.x and above.
  // @see https://www.drupal.org/i/3397493
  if ($saved_config->getName() == "block_content.type.basic") {
    if (\version_compare(\Drupal::VERSION, '10.3', '>=')) {
      $saved_config->set("revision", (bool) $saved_config->get("revision"));
    }
  }
}