You are here

public function ActionAddForm::buildForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/action/src/Form/ActionAddForm.php \Drupal\action\Form\ActionAddForm::buildForm()

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

string $action_id: The action ID.

Overrides EntityForm::buildForm

File

core/modules/action/src/Form/ActionAddForm.php, line 24

Class

ActionAddForm
Provides a form for action add forms.

Namespace

Drupal\action\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $action_id = NULL) {
  $this->entity
    ->setPlugin($action_id);

  // Derive the label and type from the action definition.
  $definition = $this->entity
    ->getPluginDefinition();
  $this->entity
    ->set('label', $definition['label']);
  $this->entity
    ->set('type', $definition['type']);
  return parent::buildForm($form, $form_state);
}