You are here

protected function Basic::getPaymentStatusSelector in Payment 8.2

Gets the payment status selector.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state:

string $type:

string $default_plugin_id:

Return value

\Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorInterface

3 calls to Basic::getPaymentStatusSelector()
Basic::getCapturePaymentStatusSelector in src/Plugin/Payment/MethodConfiguration/Basic.php
Gets the payment status selector for the capture phase.
Basic::getExecutePaymentStatusSelector in src/Plugin/Payment/MethodConfiguration/Basic.php
Gets the payment status selector for the execute phase.
Basic::getRefundPaymentStatusSelector in src/Plugin/Payment/MethodConfiguration/Basic.php
Gets the payment status selector for the refund phase.

File

src/Plugin/Payment/MethodConfiguration/Basic.php, line 409

Class

Basic
Provides the configuration for the payment_basic payment method plugin.

Namespace

Drupal\payment\Plugin\Payment\MethodConfiguration

Code

protected function getPaymentStatusSelector(FormStateInterface $form_state, $type, $default_plugin_id) {
  $key = 'payment_status_selector_' . $type;
  if ($form_state
    ->has($key)) {
    $plugin_selector = $form_state
      ->get($key);
  }
  else {
    $plugin_selector = $this->pluginSelectorManager
      ->createInstance('payment_select_list');
    $plugin_selector
      ->setSelectablePluginType($this->paymentStatusType);
    $plugin_selector
      ->setRequired(TRUE);
    $plugin_selector
      ->setCollectPluginConfiguration(FALSE);
    $plugin_selector
      ->setSelectedPlugin($this->paymentStatusType
      ->getPluginManager()
      ->createInstance($default_plugin_id));
    $form_state
      ->set($key, $plugin_selector);
  }
  return $plugin_selector;
}