You are here

protected function WizardEntityFormController::getFormArgument in Chaos Tool Suite (ctools) 8.3

Extracts the form argument string from a request.

Depending on the type of form the argument string may be stored in a different request attribute.

One example of a route definition is given below.

defaults:
_form:
Drupal\example\Form\ExampleForm;

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match object from which to extract a form definition string.

Return value

string The form definition string.

Overrides WizardFormController::getFormArgument

File

src/Controller/WizardEntityFormController.php, line 41

Class

WizardEntityFormController
Wrapping controller for wizard forms that serve as the main page body.

Namespace

Drupal\ctools\Controller

Code

protected function getFormArgument(RouteMatchInterface $route_match) {
  $form_arg = $route_match
    ->getRouteObject()
    ->getDefault('_entity_wizard');
  list($entity_type_id, $operation) = explode('.', $form_arg);
  $definition = $this->entityTypeManager
    ->getDefinition($entity_type_id);
  $handlers = $definition
    ->getHandlerClasses();
  if (empty($handlers['wizard'][$operation])) {
    throw new \Exception(sprintf('Unsupported wizard operation %s', $operation));
  }
  return $handlers['wizard'][$operation];
}