function ConfigurableEventHandlerEntityBundle::determineQualifiedEvents

Determines the qualified event names for the dispatched event.

@todo The 'object' type hint should be replaced with the appropriate class once Symfony 4 is no longer supported.

Parameters

object $event: The event data of the event being dispatched. In Drupal 9 this will be a \Symfony\Component\EventDispatcher\Event, In Drupal 10 this will be a \Symfony\Contracts\EventDispatcher\Event.

string $event_name: The event base name.

array $event_definition: The event definition. If necessary for the event, the contained context definitions may be refined as suiting for the event data.

Return value

string[] The array of qualified event name suffixes to add; e.g, 'article' if the fully-qualified event "rules_entity_view:node--article" should be triggered in addition to base event "rules_entity_view:node".

Overrides RulesConfigurableEventHandlerInterface::determineQualifiedEvents

File

src/EventHandler/ConfigurableEventHandlerEntityBundle.php, line 16

Class

ConfigurableEventHandlerEntityBundle
Exposes the bundle of an entity as event setting.

Namespace

Drupal\rules\EventHandler

Code

public static function determineQualifiedEvents(object $event, $event_name, array &$event_definition) {
  // @todo The 'object' type hint should be replaced with the appropriate
  // class once Symfony 4 is no longer supported.
  $events_suffixes = [];
  if ($event instanceof EntityEvent) {
    $events_suffixes[] = $event->getSubject()
      ->bundle();
  }
  return $events_suffixes;
}