You are here

class TermsMergedEventSubscriber in Term Merge 8

This event subscriber prints a message to the screen when some terms are merged.

Hierarchy

  • class \Drupal\term_merge_test_events\EventSubscriber\TermsMergedEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of TermsMergedEventSubscriber

1 string reference to 'TermsMergedEventSubscriber'
term_merge_test_events.services.yml in tests/term_merge_test_events/term_merge_test_events.services.yml
tests/term_merge_test_events/term_merge_test_events.services.yml
1 service uses TermsMergedEventSubscriber
term_merge_event_subscriber in tests/term_merge_test_events/term_merge_test_events.services.yml
\Drupal\term_merge_test_events\EventSubscriber\TermsMergedEventSubscriber

File

tests/term_merge_test_events/src/EventSubscriber/TermsMergedEventSubscriber.php, line 13

Namespace

Drupal\term_merge_test_events\EventSubscriber
View source
class TermsMergedEventSubscriber implements EventSubscriberInterface {

  /**
   * Code that is executed when the event is triggered.
   */
  public function onTermMerge(TermsMergedEvent $event) {
    \Drupal::messenger()
      ->addMessage('The TermsMergedEvent was triggered.');
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[TermMergeEventNames::TERMS_MERGED][] = [
      'onTermMerge',
    ];
    return $events;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TermsMergedEventSubscriber::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
TermsMergedEventSubscriber::onTermMerge public function Code that is executed when the event is triggered.