function BlockVariantTrait::eventDispatcher

Same name and namespace in other branches
  1. 4.0.x src/Plugin/BlockVariantTrait.php \Drupal\ctools\Plugin\BlockVariantTrait::eventDispatcher()

Gets the event dispatcher.

Return value

\Symfony\Component\EventDispatcher\EventDispatcherInterface

File

src/Plugin/BlockVariantTrait.php, line 148

Class

BlockVariantTrait
Provides methods for <a href="/api/ctools/src%21Plugin%21BlockVariantInterface.php/interface/BlockVariantInterface/8.x-3.x" title="Provides an interface for variant plugins that use block plugins." class="local">\Drupal\ctools\Plugin\BlockVariantInterface</a>.

Namespace

Drupal\ctools\Plugin

Code

protected function eventDispatcher() {
    if (!$this->eventDispatcher) {
        $this->eventDispatcher = \Drupal::service('event_dispatcher');
    }
    return $this->eventDispatcher;
}