Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/CivicrmEventSubscriberInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Drupal\civicrm;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
* Interface for use with CiviCRM related events.
*/
interface CivicrmEventSubscriberInterface extends EventSubscriberInterface {}
11 changes: 10 additions & 1 deletion src/CivicrmServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* tagged "civicrm.event_subscriber" and hands their IDs to the registrar, which
* attaches them to \Civi::dispatcher() once CiviCRM has booted.
*
* @see \Drupal\civicrm\CivicrmEventSubscriberInterface
* @see \Drupal\civicrm\EventSubscriberRegistrar
* @see civicrm_civicrm_config()
*/
Expand All @@ -21,7 +22,15 @@ class CivicrmServiceProvider extends ServiceProviderBase {
/**
* {@inheritdoc}
*/
public function alter(ContainerBuilder $container) {
public function register(ContainerBuilder $container): void {
$container->registerForAutoconfiguration(CivicrmEventSubscriberInterface::class)
->addTag('civicrm.event_subscriber');
}

/**
* {@inheritdoc}
*/
public function alter(ContainerBuilder $container): void {
if (!$container->hasDefinition('civicrm.event_subscriber_registrar')) {
return;
}
Expand Down