You are here

class PaymentAwarePluginManagerDecorator in Payment 8.2

Provides a payment-aware plugin manager decorator.

Hierarchy

Expanded class hierarchy of PaymentAwarePluginManagerDecorator

3 files declare their use of PaymentAwarePluginManagerDecorator
PaymentAwarePluginFilteredPluginManagerTest.php in tests/src/Unit/Plugin/Payment/PaymentAwarePluginFilteredPluginManagerTest.php
PaymentExecutionPaymentMethodManager.php in src/Plugin/Payment/Method/PaymentExecutionPaymentMethodManager.php
PaymentStatusForm.php in src/Entity/Payment/PaymentStatusForm.php

File

src/Plugin/Payment/PaymentAwarePluginManagerDecorator.php, line 18

Namespace

Drupal\payment\Plugin\Payment
View source
class PaymentAwarePluginManagerDecorator extends PluginManagerDecorator {

  /**
   * The payment to inject into plugin instances.
   *
   * @var \Drupal\payment\Entity\PaymentInterface
   */
  protected $payment;

  /**
   * Creates a new instance.
   *
   * @param \Drupal\payment\Entity\PaymentInterface $payment
   *   The payment to inject into payment-aware plugin instances.
   * @param \Drupal\Component\Plugin\PluginManagerInterface $plugin_manager
   *   The decorated plugin manager.
   * @param \Drupal\Component\Plugin\Discovery\DiscoveryInterface|null $discovery
   *   A plugin discovery to use instead of the decorated plugin manager, or
   *   NULL to use the decorated plugin manager.
   */
  public function __construct(PaymentInterface $payment, PluginManagerInterface $plugin_manager, DiscoveryInterface $discovery = NULL) {
    parent::__construct($plugin_manager, $discovery);
    $this->payment = $payment;
  }

  /**
   * {@inheritdoc}
   */
  public function createInstance($plugin_id, array $configuration = []) {
    $plugin = $this->decoratedFactory
      ->createInstance($plugin_id, $configuration);
    if ($plugin instanceof PaymentAwareInterface) {
      $plugin
        ->setPayment($this->payment);
    }
    return $plugin;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
DiscoveryTrait::doGetDefinition protected function Gets a specific plugin definition.
DiscoveryTrait::getDefinition public function 3
DiscoveryTrait::hasDefinition public function
PaymentAwarePluginManagerDecorator::$payment protected property The payment to inject into plugin instances.
PaymentAwarePluginManagerDecorator::createInstance public function Creates a pre-configured instance of a plugin. Overrides PluginManagerDecorator::createInstance
PaymentAwarePluginManagerDecorator::__construct public function Creates a new instance. Overrides PluginManagerDecorator::__construct 1
PluginDiscoveryDecorator::$decoratedDiscovery protected property The decorated discovery.
PluginDiscoveryDecorator::$pluginDefinitions protected property The processed plugin definitions.
PluginDiscoveryDecorator::$useCaches protected property Whether or not to use plugin caching.
PluginDiscoveryDecorator::clearCachedDefinitions public function Clears static and persistent plugin definition caches. Overrides CachedDiscoveryInterface::clearCachedDefinitions
PluginDiscoveryDecorator::getDefinitions public function Gets the definition of all plugins for this type. Overrides DiscoveryTrait::getDefinitions
PluginDiscoveryDecorator::processDecoratedDefinitions protected function Processes the definitions from the decorated discovery. 2
PluginDiscoveryDecorator::useCaches public function Disable the use of caches. Overrides CachedDiscoveryInterface::useCaches
PluginManagerDecorator::$decoratedFactory protected property The decorated plugin factory.
PluginManagerDecorator::getInstance public function Gets a preconfigured instance of a plugin. Overrides MapperInterface::getInstance