You are here

protected function PaymentForm::getPaymentMethodManager in Payment 8.2

Gets the payment method manager.

Return value

\Drupal\payment\Plugin\Payment\Method\PaymentMethodManagerInterface

1 call to PaymentForm::getPaymentMethodManager()
PaymentForm::getPluginSelector in modules/payment_form/src/Entity/Payment/PaymentForm.php
Gets the plugin selector.

File

modules/payment_form/src/Entity/Payment/PaymentForm.php, line 191

Class

PaymentForm
Provides the payment form.

Namespace

Drupal\payment_form\Entity\Payment

Code

protected function getPaymentMethodManager() {
  $config = $this
    ->config('payment_form.payment_type');
  $limit_allowed_plugins = $config
    ->get('limit_allowed_plugins');
  $payment_method_discovery = $this->paymentMethodType
    ->getPluginManager();
  if ($limit_allowed_plugins) {
    $allowed_plugin_ids = $config
      ->get('allowed_plugin_ids');
    $payment_method_discovery = new LimitedPluginDiscoveryDecorator($payment_method_discovery);
    $payment_method_discovery
      ->setDiscoveryLimit($allowed_plugin_ids);
  }
  $payment_method_manager = new PaymentExecutionPaymentMethodManager($this
    ->getEntity(), $this->currentUser, $this->paymentMethodType
    ->getPluginManager(), $payment_method_discovery);
  return $payment_method_manager;
}