You are here

public function TaskTypeForm::form in General Data Protection Regulation 3.0.x

Same name and namespace in other branches
  1. 8.2 modules/gdpr_tasks/src/Form/TaskTypeForm.php \Drupal\gdpr_tasks\Form\TaskTypeForm::form()
  2. 8 modules/gdpr_tasks/src/Form/TaskTypeForm.php \Drupal\gdpr_tasks\Form\TaskTypeForm::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

modules/gdpr_tasks/src/Form/TaskTypeForm.php, line 16

Class

TaskTypeForm
Class TaskTypeForm.

Namespace

Drupal\gdpr_tasks\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $gdpr_task_type = $this->entity;
  $form['label'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Label'),
    '#maxlength' => 255,
    '#default_value' => $gdpr_task_type
      ->label(),
    '#description' => $this
      ->t("Label for the Task type."),
    '#required' => TRUE,
  ];
  $form['id'] = [
    '#type' => 'machine_name',
    '#default_value' => $gdpr_task_type
      ->id(),
    '#machine_name' => [
      'exists' => '\\Drupal\\gdpr_tasks\\Entity\\TaskType::load',
    ],
    '#disabled' => !$gdpr_task_type
      ->isNew(),
  ];

  /* You will need additional form elements for your custom properties. */
  return $form;
}