You are here

class ExamplePreprocessEventFactory in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 examples/preprocess_example_module/src/Factory/ExamplePreprocessEventFactory.php \Drupal\preprocess_example_module\Factory\ExamplePreprocessEventFactory

Class ExamplePreprocessEventFactory.

Hierarchy

Expanded class hierarchy of ExamplePreprocessEventFactory

1 string reference to 'ExamplePreprocessEventFactory'
preprocess_example_module.services.yml in examples/preprocess_example_module/preprocess_example_module.services.yml
examples/preprocess_example_module/preprocess_example_module.services.yml
1 service uses ExamplePreprocessEventFactory
preprocess_event.factory.example in examples/preprocess_example_module/preprocess_example_module.services.yml
Drupal\preprocess_example_module\Factory\ExamplePreprocessEventFactory

File

examples/preprocess_example_module/src/Factory/ExamplePreprocessEventFactory.php, line 13

Namespace

Drupal\preprocess_example_module\Factory
View source
class ExamplePreprocessEventFactory implements PreprocessEventFactoryInterface {

  /**
   * Create the PreprocessEvent with the Variables object embedded.
   *
   * @param array $variables
   *   Variables.
   *
   * @return \Drupal\preprocess_event_dispatcher\Event\AbstractPreprocessEvent
   *   Created event.
   */
  public function createEvent(array &$variables) : AbstractPreprocessEvent {
    return new ExamplePreprocessEvent(new ExampleEventVariables($variables));
  }

  /**
   * {@inheritdoc}
   */
  public function getEventHook() : string {
    return ExamplePreprocessEvent::getHook();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ExamplePreprocessEventFactory::createEvent public function Create the PreprocessEvent with the Variables object embedded. Overrides PreprocessEventFactoryInterface::createEvent
ExamplePreprocessEventFactory::getEventHook public function Get the Event hook name. Overrides PreprocessEventFactoryInterface::getEventHook