You are here

public function IssueTypeForm::form in Drupal PM (Project Management) 4.x

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/pm_issue/src/Form/IssueTypeForm.php, line 18

Class

IssueTypeForm
Provides a form for editing a Issue type.

Namespace

Drupal\pm_issue\Form

Code

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

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