You are here

public function ConfigurePaymentType::execute in Payment 8.2

Builds the payment type's configuration form.

Parameters

string $bundle: The payment bundle, also known as the payment type's plugin ID.

Return value

array A renderable array

Throws

\Symfony\Component\HttpKernel\Exception\NotFoundHttpException

1 string reference to 'ConfigurePaymentType::execute'
payment.routing.yml in ./payment.routing.yml
payment.routing.yml

File

src/Controller/ConfigurePaymentType.php, line 57

Class

ConfigurePaymentType
Handles the "configure payment type" route.

Namespace

Drupal\payment\Controller

Code

public function execute($bundle) {
  $definition = $this->paymentTypeManager
    ->getDefinition($bundle, FALSE);
  if (is_null($definition)) {
    throw new NotFoundHttpException();
  }
  elseif (isset($definition['configuration_form'])) {
    return $this->formBuilder
      ->getForm($definition['configuration_form']);
  }
  else {
    return [
      '#markup' => $this
        ->t('This payment type has no configuration.'),
    ];
  }
}