You are here

function ConfigSubscriber::onConfigSave in Apache Solr Multilingual 8

File

src/EventSubscriber/ConfigSubscriber.php, line 36
Contains \Drupal\apachesolr_multilingual\EventSubscriber\ConfigSubscriber.

Class

ConfigSubscriber

Namespace

Drupal\apachesolr_multilingual\EventSubscriber

Code

function onConfigSave(ConfigCrudEvent $event) {
  $saved_config = $event
    ->getConfig();
  if (preg_match('@^language\\.entity\\.(.+)@', $saved_config
    ->getName(), $matches) && $matches[1] != 'und') {
    $restrict_by_dependency = [
      'module' => 'apachesolr_multilingual',
    ];

    // installOptionalConfig will not replace existing configs
    // and it contains a dependency check so we need not perform
    // any checks ourselves
    $this->configInstaller
      ->installOptionalConfig(NULL, $restrict_by_dependency);
  }

  // drupal_set_message($saved_config->getName());
  // drupal_set_message(print_r($saved_config->getRawData(), TRUE));
}