You are here

public function TeamForm::form in Apigee Edge 8

Gets the actual form array to be built.

Overrides FieldableEdgeEntityForm::form

See also

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

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

File

modules/apigee_edge_teams/src/Entity/Form/TeamForm.php, line 115

Class

TeamForm
General form handler for the team create/edit forms.

Namespace

Drupal\apigee_edge_teams\Entity\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);

  /** @var \Drupal\apigee_edge_teams\Entity\TeamInterface $team */
  $team = $this->entity;
  $form['name'] = [
    '#title' => $this
      ->t('Internal name'),
    '#type' => 'machine_name',
    '#machine_name' => [
      'source' => [
        'displayName',
        'widget',
        0,
        'value',
      ],
      'label' => $this
        ->t('Internal name'),
      'exists' => [
        $this,
        'exists',
      ],
    ],
    '#disabled' => !$team
      ->isNew(),
    '#default_value' => $team
      ->id(),
  ];
  return $form;
}