class ConfigSubscriber in Menu Link Weight 8
Same name and namespace in other branches
- 8.2 src/EventSubscriber/ConfigSubscriber.php \Drupal\menu_link_weight\EventSubscriber\ConfigSubscriber
Hierarchy
- class \Drupal\menu_link_weight\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 10
Namespace
Drupal\menu_link_weight\EventSubscriberView source
class ConfigSubscriber implements EventSubscriberInterface {
/**
* The Drupal Kernel.
*
* @var \Drupal\Core\DrupalKernelInterface
*/
protected $kernel;
/**
* ConfigSubscriber constructor.
*
* @param \Drupal\Core\DrupalKernelInterface $kernel
* The Drupal Kernel.
*/
public function __construct(DrupalKernelInterface $kernel) {
$this->kernel = $kernel;
}
/**
* Causes the container to be rebuilt on the next request.
*
* @param ConfigCrudEvent $event
* The configuration event.
*/
public function onConfigSave(ConfigCrudEvent $event) {
$saved_config = $event
->getConfig();
if ($saved_config
->getName() == 'menu_link_weight.settings' && $event
->isChanged('menu_parent_form_selector')) {
$this->kernel
->invalidateContainer();
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[ConfigEvents::SAVE][] = [
'onConfigSave',
0,
];
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigSubscriber:: |
protected | property | The Drupal Kernel. | |
ConfigSubscriber:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
ConfigSubscriber:: |
public | function | Causes the container to be rebuilt on the next request. | |
ConfigSubscriber:: |
public | function | ConfigSubscriber constructor. |