You are here

private function PreprocessEventService::dispatchEntitySpecificEvents in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 modules/preprocess_event_dispatcher/src/Service/PreprocessEventService.php \Drupal\preprocess_event_dispatcher\Service\PreprocessEventService::dispatchEntitySpecificEvents()

Dispatch the entity events.

Parameters

\Drupal\preprocess_event_dispatcher\Event\PreprocessEntityEventInterface $event: The event to dispatch.

1 call to PreprocessEventService::dispatchEntitySpecificEvents()
PreprocessEventService::createAndDispatchKnownEvents in modules/preprocess_event_dispatcher/src/Service/PreprocessEventService.php
Create and dispatch the event.

File

modules/preprocess_event_dispatcher/src/Service/PreprocessEventService.php, line 63

Class

PreprocessEventService
Class PreprocessEventService.

Namespace

Drupal\preprocess_event_dispatcher\Service

Code

private function dispatchEntitySpecificEvents(PreprocessEntityEventInterface $event) : void {
  $variables = $event
    ->getVariables();
  $withBundle = $event::name($variables
    ->getEntityBundle());
  $this->dispatcher
    ->dispatch($withBundle, $event);
  $withViewMode = $event::name($variables
    ->getEntityBundle(), $variables
    ->getViewMode());
  $this->dispatcher
    ->dispatch($withViewMode, $event);
}