You are here

public function PaymentAwarePluginManagerDecorator::createInstance in Payment 8.2

Creates a pre-configured instance of a plugin.

Parameters

string $plugin_id: The ID of the plugin being instantiated.

array $configuration: An array of configuration relevant to the plugin instance.

Return value

object A fully configured plugin instance.

Throws

\Drupal\Component\Plugin\Exception\PluginException If the instance cannot be created, such as if the ID is invalid.

Overrides PluginManagerDecorator::createInstance

1 call to PaymentAwarePluginManagerDecorator::createInstance()
PaymentExecutionPaymentMethodManager::processDecoratedDefinitions in src/Plugin/Payment/Method/PaymentExecutionPaymentMethodManager.php
Processes the definitions from the decorated discovery.

File

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

Class

PaymentAwarePluginManagerDecorator
Provides a payment-aware plugin manager decorator.

Namespace

Drupal\payment\Plugin\Payment

Code

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