You are here

private function PreprocessEventService::dispatchEntitySpecificEvents in Hook Event Dispatcher 8

Dispatch the entity events.

Parameters

\Drupal\hook_event_dispatcher\Event\Preprocess\PreprocessEntityEventInterface $event: The event to dispatch.

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

File

src/Service/PreprocessEventService.php, line 68

Class

PreprocessEventService
Class PreprocessEventService.

Namespace

Drupal\hook_event_dispatcher\Service

Code

private function dispatchEntitySpecificEvents(PreprocessEntityEventInterface $event) {
  $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);
}