function ActionAddForm::buildForm

Same name in other branches
  1. 9 core/modules/action/src/Form/ActionAddForm.php \Drupal\action\Form\ActionAddForm::buildForm()
  2. 8.9.x core/modules/action/src/Form/ActionAddForm.php \Drupal\action\Form\ActionAddForm::buildForm()
  3. 11.x 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.