You are here

public function TeamRoleForm::form in Apigee Edge 8

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/apigee_edge_teams/src/Form/TeamRoleForm.php, line 16

Class

TeamRoleForm
Class TeamRoleForm.

Namespace

Drupal\apigee_edge_teams\Form

Code

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