function ActionFormBase::form
Same name in other branches
- 9 core/modules/action/src/Form/ActionFormBase.php \Drupal\action\Form\ActionFormBase::form()
- 8.9.x core/modules/action/src/Form/ActionFormBase.php \Drupal\action\Form\ActionFormBase::form()
- 11.x core/modules/action/src/Form/ActionFormBase.php \Drupal\action\Form\ActionFormBase::form()
Overrides EntityForm::form
File
-
core/
modules/ action/ src/ Form/ ActionFormBase.php, line 52
Class
- ActionFormBase
- Provides a base form for action forms.
Namespace
Drupal\action\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form['label'] = [
'#type' => 'textfield',
'#title' => $this->t('Label'),
'#default_value' => $this->entity
->label(),
'#maxlength' => '255',
'#description' => $this->t('A unique label for this advanced action. This label will be displayed in the interface of modules that integrate with actions.'),
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $this->entity
->id(),
'#disabled' => !$this->entity
->isNew(),
'#maxlength' => 64,
'#description' => $this->t('A unique name for this action. It must only contain lowercase letters, numbers and underscores.'),
'#machine_name' => [
'exists' => [
$this,
'exists',
],
],
];
$form['plugin'] = [
'#type' => 'value',
'#value' => $this->entity
->get('plugin'),
];
$form['type'] = [
'#type' => 'value',
'#value' => $this->entity
->getType(),
];
if ($plugin = $this->getPlugin()) {
$form += $plugin->buildConfigurationForm($form, $form_state);
}
return parent::form($form, $form_state);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.