function ActionAddForm::buildForm

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

string $action_id: The action ID.

Overrides EntityForm::buildForm

File

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

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.