public function ActionFormControllerBase::form

Returns the actual form array to be built.

Overrides EntityFormController::form

See also

Drupal\Core\Entity\EntityFormController::build()

File

drupal/core/modules/action/lib/Drupal/action/ActionFormControllerBase.php, line 67
Contains Drupal\action\ActionEditFormController.

Class

ActionFormControllerBase
Provides a base form controller for action forms.

Namespace

Drupal\action

Code

public function form(array $form, array &$form_state) {
  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => t('Label'),
    '#default_value' => $this->entity
      ->label(),
    '#maxlength' => '255',
    '#description' => 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',
    '#title' => t('Machine name'),
    '#default_value' => $this->entity
      ->id(),
    '#disabled' => !$this->entity
      ->isNew(),
    '#maxlength' => 64,
    '#description' => 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 ConfigurableActionInterface) {
    $form += $this->plugin
      ->form($form, $form_state);
  }
  return parent::form($form, $form_state);
}