function ModuleInstallConfigTestSubscriber::onSave

Reacts to a test simple configuration object being installed.

Parameters

\Drupal\Core\Config\ConfigCrudEvent $event: The ConfigCrudEvent to process.

File

core/modules/system/tests/modules/module_installer_config_subscriber/src/EventSubscriber/ModuleInstallConfigTestSubscriber.php, line 33

Class

ModuleInstallConfigTestSubscriber
Test subscriber for configuration CRUD event.

Namespace

Drupal\module_installer_config_subscriber\EventSubscriber

Code

public function onSave(ConfigCrudEvent $event) : void {
  if ($event->getConfig()
    ->getName() !== 'module_installer_config_subscriber.settings' || !($definition = $this->entityTypeManager
    ->getDefinition('node', FALSE))) {
    return;
  }
  $table = $definition->get('data_table');
  if (!$this->connection
    ->schema()
    ->tableExists($table)) {
    $this->keyValue
      ->get('module_installer_config_subscriber')
      ->set('node_tables_missing', TRUE);
  }
}

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