/**
  * {@inheritdoc}
  */
 public function getValueOptions()
 {
     if (!isset($this->valueOptions)) {
         $this->valueTitle = $this->t('Payment method');
         foreach ($this->paymentMethodManager->getDefinitions() as $plugin_id => $definition) {
             $this->valueOptions[$plugin_id] = $definition['label'];
         }
     }
     return $this->valueOptions;
 }
 /**
  * Lists all available payment method plugins.
  *
  * @return array
  *   A renderable array.
  */
 public function execute()
 {
     $rows = [];
     foreach ($this->paymentMethodManager->getDefinitions() as $plugin_id => $definition) {
         $operations_provider = $this->paymentMethodManager->getOperationsProvider($plugin_id);
         $row = ['label' => ['#markup' => $definition['label']], 'status' => ['#markup' => $definition['active'] ? $this->t('Enabled') : $this->t('Disabled')], 'operations' => ['#type' => 'operations', '#links' => $operations_provider ? $operations_provider->getOperations($plugin_id) : []]];
         if (!$definition['active']) {
             $row['#attributes']['class'] = ['payment-method-disabled'];
         }
         $rows[$plugin_id] = $row;
     }
     return ['#attached' => ['library' => ['payment/payment_method.list']], '#attributes' => ['class' => ['payment-method-list']], '#header' => [$this->t('Name'), $this->t('Status'), $this->t('Operations')], '#type' => 'table'] + $rows;
 }
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $config = $this->config('payment_form.payment_type');
     $form['plugin_selector'] = $this->getPluginSelector($form_state)->buildSelectorForm([], $form_state);
     $limit_allowed_plugins_id = Html::getUniqueId('limit_allowed_plugins');
     $form['limit_allowed_plugins'] = ['#default_value' => $config->get('limit_allowed_plugins'), '#id' => $limit_allowed_plugins_id, '#title' => $this->t('Limit allowed payment methods'), '#type' => 'checkbox'];
     $allowed_plugin_ids = $config->get('allowed_plugin_ids');
     $options = [];
     foreach ($this->paymentMethodManager->getDefinitions() as $definition) {
         $options[$definition['id']] = $definition['label'];
     }
     $form['allowed_plugin_ids'] = ['#default_value' => $allowed_plugin_ids, '#multiple' => TRUE, '#options' => $options, '#states' => ['visible' => ['#' . $limit_allowed_plugins_id => ['checked' => TRUE]]], '#title' => $this->t('Allowed payment methods'), '#type' => 'select'];
     return $form + parent::buildForm($form, $form_state);
 }