You are here

class ReferenceablePluginTypesSubscriber in Commerce Core 8.2

Hierarchy

Expanded class hierarchy of ReferenceablePluginTypesSubscriber

1 string reference to 'ReferenceablePluginTypesSubscriber'
commerce_test.services.yml in tests/modules/commerce_test/commerce_test.services.yml
tests/modules/commerce_test/commerce_test.services.yml
1 service uses ReferenceablePluginTypesSubscriber
commerce_test.referenceable_plugin_types_subscriber in tests/modules/commerce_test/commerce_test.services.yml
\Drupal\commerce_test\EventSubscriber\ReferenceablePluginTypesSubscriber

File

tests/modules/commerce_test/src/EventSubscriber/ReferenceablePluginTypesSubscriber.php, line 10

Namespace

Drupal\commerce_test\EventSubscriber
View source
class ReferenceablePluginTypesSubscriber implements EventSubscriberInterface {
  use StringTranslationTrait;

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[CommerceEvents::REFERENCEABLE_PLUGIN_TYPES][] = [
      'onPluginTypes',
    ];
    return $events;
  }

  /**
   * Registers the 'commerce_payment_method_type' plugin type as referenceable.
   *
   * Needed by PluginSelectTest.
   *
   * @param \Drupal\commerce\Event\ReferenceablePluginTypesEvent $event
   *   The event.
   */
  public function onPluginTypes(ReferenceablePluginTypesEvent $event) {
    $types = $event
      ->getPluginTypes();
    $types['commerce_payment_method_type'] = $this
      ->t('Payment method type');
    $event
      ->setPluginTypes($types);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ReferenceablePluginTypesSubscriber::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
ReferenceablePluginTypesSubscriber::onPluginTypes public function Registers the 'commerce_payment_method_type' plugin type as referenceable.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.