You are here

public function ActionAddForm::buildForm in Drupal 8

Same name and namespace in other branches
  1. 9 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);
}