You are here

public function ActionFormBase::form in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/action/src/ActionFormBase.php \Drupal\action\ActionFormBase::form()

Gets the actual form array to be built.

Overrides EntityForm::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

File

core/modules/action/src/ActionFormBase.php, line 65
Contains \Drupal\action\ActionFormBase.

Class

ActionFormBase
Provides a base form for action forms.

Namespace

Drupal\action

Code

public function form(array $form, FormStateInterface $form_state) {
  $form['label'] = array(
    '#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'] = array(
    '#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' => array(
      'exists' => array(
        $this,
        'exists',
      ),
    ),
  );
  $form['plugin'] = array(
    '#type' => 'value',
    '#value' => $this->entity
      ->get('plugin'),
  );
  $form['type'] = array(
    '#type' => 'value',
    '#value' => $this->entity
      ->getType(),
  );
  if ($this->plugin instanceof PluginFormInterface) {
    $form += $this->plugin
      ->buildConfigurationForm($form, $form_state);
  }
  return parent::form($form, $form_state);
}