/** * {@inheritdoc} */ public function getOperationsProvider($plugin_id) { if ($this->hasDefinition($plugin_id)) { return $this->decoratedPaymentMethodManager->getOperationsProvider($plugin_id); } else { throw new PluginNotFoundException($plugin_id); } }
/** * 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; }