1 {% extends "base/class.php.twig" %}
4 \Drupal\{{module}}\{{ class }}.
7 {% block namespace_class %}
8 namespace Drupal\{{module}}\EventSubscriber;
12 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
13 use Symfony\Component\EventDispatcher\Event;
16 {% block class_declaration %}
20 * @package Drupal\{{module}}
22 class {{ class }} implements EventSubscriberInterface {% endblock %}
24 {% block class_construct %}
29 public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
30 {{ serviceClassInitialization(services) }}
35 {% block class_methods %}
39 static function getSubscribedEvents() {
40 {% for event_name, callback in events %}
41 $events['{{ event_name }}'] = ['{{ callback }}'];
47 {% for event_name, callback in events %}
49 * This method is called whenever the {{ event_name }} event is
52 * @param GetResponseEvent $event
54 public function {{ callback }}(Event $event) {
55 drupal_set_message('Event {{ event_name }} thrown by Subscriber in module {{ module }}.', 'status', TRUE);