function EventsExampleSubscriber::notifyDefault

Same name in other branches
  1. 3.x modules/events_example/src/EventSubscriber/EventsExampleSubscriber.php \Drupal\events_example\EventSubscriber\EventsExampleSubscriber::notifyDefault()

Handle incidents not handled by the other handlers.

Parameters

\Drupal\events_example\Event\IncidentReportEvent $event: The event object containing the incident report.

File

modules/events_example/src/EventSubscriber/EventsExampleSubscriber.php, line 124

Class

EventsExampleSubscriber
Subscribe to IncidentEvents::NEW_REPORT events and react to new reports.

Namespace

Drupal\events_example\EventSubscriber

Code

public function notifyDefault(IncidentReportEvent $event) {
    $this->messenger()
        ->addStatus($this->t('Thank you for reporting this incident. This message was set by an event subscriber. See @method()', [
        '@method' => __METHOD__,
    ]));
    $event->stopPropagation();
}