class ConfigImportEventSubscriber in ThemeKey 8
Defines a event listener implementation for config import.
Hierarchy
- class \Drupal\themekey\EventSubscriber\ConfigImportEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface uses RuleChainManagerTrait
Expanded class hierarchy of ConfigImportEventSubscriber
1 string reference to 'ConfigImportEventSubscriber'
1 service uses ConfigImportEventSubscriber
File
- src/
EventSubscriber/ ConfigImportEventSubscriber.php, line 14
Namespace
Drupal\themekey\EventSubscriberView source
class ConfigImportEventSubscriber implements EventSubscriberInterface {
use RuleChainManagerTrait;
public function onConfigImporterValidate(ConfigImporterEvent $event) {
// TODO validate chain: check if all rules exist / are already imported
}
public function onConfigImporterSave(ConfigCrudEvent $event) {
$ruleChainManager = $this
->getRuleChainManager();
$ruleChainManager
->rebuildOptimizedChain($event
->getConfig()
->get('chain'));
}
/**
* {@inheritdoc}
*/
static function getSubscribedEvents() {
$events[ConfigEvents::IMPORT_VALIDATE][] = array(
'onConfigImporterValidate',
20,
);
$events[ConfigEvents::SAVE][] = array(
'onConfigImporterSave',
20,
);
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigImportEventSubscriber:: |
static | function | Returns an array of event names this subscriber wants to listen to. | |
ConfigImportEventSubscriber:: |
public | function | ||
ConfigImportEventSubscriber:: |
public | function | ||
RuleChainManagerTrait:: |
private | property | @var | |
RuleChainManagerTrait:: |
protected | function | Gets the ThemeKey Rule Chain manager. | 1 |
RuleChainManagerTrait:: |
public | function | Sets the ThemeKey Rule Chain manager to use. |