class ContentTypesUpdatedSubscriber in Allow a content type only once (Only One) 8
Class ContentTypesUpdatedSubscriber.
Hierarchy
- class \Drupal\onlyone_admin_toolbar\EventSubscriber\ContentTypesUpdatedSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of ContentTypesUpdatedSubscriber
1 string reference to 'ContentTypesUpdatedSubscriber'
- onlyone_admin_toolbar.services.yml in modules/
onlyone_admin_toolbar/ onlyone_admin_toolbar.services.yml - modules/onlyone_admin_toolbar/onlyone_admin_toolbar.services.yml
1 service uses ContentTypesUpdatedSubscriber
- onlyone.content_types.updated in modules/
onlyone_admin_toolbar/ onlyone_admin_toolbar.services.yml - Drupal\onlyone_admin_toolbar\EventSubscriber\ContentTypesUpdatedSubscriber
File
- modules/
onlyone_admin_toolbar/ src/ EventSubscriber/ ContentTypesUpdatedSubscriber.php, line 12
Namespace
Drupal\onlyone_admin_toolbar\EventSubscriberView source
class ContentTypesUpdatedSubscriber implements EventSubscriberInterface {
/**
* The route builder.
*
* @var \Drupal\Core\Routing\RouteBuilderInterface
*/
protected $routeBuilder;
/**
* Constructor.
*
* @param \Drupal\Core\Routing\RouteBuilderInterface $route_builder
* The route builder.
*/
public function __construct(RouteBuilderInterface $route_builder) {
$this->routeBuilder = $route_builder;
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events = [];
$events[OnlyOneEvents::CONTENT_TYPES_UPDATED][] = [
'rebuildMenu',
0,
];
return $events;
}
/**
* Subscriber Callback for the event OnlyOneEvents::CONTENT_TYPES_UPDATED.
*/
public function rebuildMenu() {
$this->routeBuilder
->rebuild();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentTypesUpdatedSubscriber:: |
protected | property | The route builder. | |
ContentTypesUpdatedSubscriber:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
ContentTypesUpdatedSubscriber:: |
public | function | Subscriber Callback for the event OnlyOneEvents::CONTENT_TYPES_UPDATED. | |
ContentTypesUpdatedSubscriber:: |
public | function | Constructor. |