function EventsExampleForm::__construct

Same name in other branches
  1. 3.x modules/events_example/src/Form/EventsExampleForm.php \Drupal\events_example\Form\EventsExampleForm::__construct()

Constructs a new UserLoginForm.

Parameters

\Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher: The event dispatcher service.

File

modules/events_example/src/Form/EventsExampleForm.php, line 40

Class

EventsExampleForm
Implements the SimpleForm form controller.

Namespace

Drupal\events_example\Form

Code

public function __construct(EventDispatcherInterface $event_dispatcher) {
    // The event dispatcher service is an implementation of
    // \Symfony\Component\EventDispatcher\EventDispatcherInterface. In Drupal
    // this is generally and instance of the
    // \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher service.
    // This dispatcher improves performance when dispatching events by compiling
    // a list of subscribers into the service container so that they do not need
    // to be looked up every time.
    $this->eventDispatcher = $event_dispatcher;
}