You are here

public static function ReferenceablePluginTypesSubscriber::getSubscribedEvents in Recurring Time Period 8

File

src/EventSubscriber/ReferenceablePluginTypesSubscriber.php, line 23

Class

ReferenceablePluginTypesSubscriber
Registers our plugin type as refereceable by Commerce's plugin field.

Namespace

Drupal\recurring_period\EventSubscriber

Code

public static function getSubscribedEvents() {

  // Too early to check for commerce module with the module handler service.
  // Can't check for whether the CommerceEvents::REFERENCEABLE_PLUGIN_TYPES
  // constant is defined.
  // Check for the class that provides the constant instead.
  if (class_exists(CommerceEvents::class)) {
    return [
      CommerceEvents::REFERENCEABLE_PLUGIN_TYPES => 'onPluginTypes',
    ];
  }
  else {
    return [];
  }
}