class ConfigSubscriber in Apache Solr Multilingual 8
Hierarchy
- class \Drupal\apachesolr_multilingual\EventSubscriber\ConfigSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of ConfigSubscriber
1 string reference to 'ConfigSubscriber'
1 service uses ConfigSubscriber
File
- src/
EventSubscriber/ ConfigSubscriber.php, line 14 - Contains \Drupal\apachesolr_multilingual\EventSubscriber\ConfigSubscriber.
Namespace
Drupal\apachesolr_multilingual\EventSubscriberView source
class ConfigSubscriber implements EventSubscriberInterface {
/**
* The config installer.
*/
protected $configInstaller;
/**
* @param $configInstaller
* The Config Installer.
*/
public function __construct(ConfigInstallerInterface $configInstaller) {
$this->configInstaller = $configInstaller;
}
/**
* {@inheritdoc}
*/
static function getSubscribedEvents() {
$events[ConfigEvents::SAVE][] = array(
'onConfigSave',
);
return $events;
}
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));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigSubscriber:: |
protected | property | The config installer. | |
ConfigSubscriber:: |
static | function | Returns an array of event names this subscriber wants to listen to. | |
ConfigSubscriber:: |
function | |||
ConfigSubscriber:: |
public | function |