class ConfigurationSubscriber in Facets 8
Config subscriber for facet delete.
Hierarchy
- class \Drupal\facets\EventSubscriber\ConfigurationSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of ConfigurationSubscriber
1 string reference to 'ConfigurationSubscriber'
1 service uses ConfigurationSubscriber
File
- src/
EventSubscriber/ ConfigurationSubscriber.php, line 13
Namespace
Drupal\facets\EventSubscriberView source
class ConfigurationSubscriber implements EventSubscriberInterface {
/**
* Drupal core's block manager.
*
* @var \Drupal\Core\Block\BlockManagerInterface
*/
protected $blockManager;
/**
* Create an instance of the class.
*
* @param \Drupal\Core\Block\BlockManagerInterface $block_manager
* Core's block manager.
*/
public function __construct(BlockManagerInterface $block_manager) {
$this->blockManager = $block_manager;
}
/**
* Reacts to a config delete event to clear the required caches.
*
* @param \Drupal\Core\Config\ConfigCrudEvent $event
* The config delete event.
*/
public function onConfigDelete(ConfigCrudEvent $event) {
$config = $event
->getConfig();
if (strpos($config
->getName(), 'facets') !== FALSE) {
$this->blockManager
->clearCachedDefinitions();
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[ConfigEvents::DELETE][] = [
'onConfigDelete',
50,
];
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigurationSubscriber:: |
protected | property | Drupal core's block manager. | |
ConfigurationSubscriber:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
ConfigurationSubscriber:: |
public | function | Reacts to a config delete event to clear the required caches. | |
ConfigurationSubscriber:: |
public | function | Create an instance of the class. |