You are here

public function EventTypeForm::form in Event 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

src/Form/EventTypeForm.php, line 16

Class

EventTypeForm
Class EventTypeForm.

Namespace

Drupal\event\Form

Code

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

  /** @var \Drupal\event\Entity\EventTypeInterface $event_type */
  $event_type = $this->entity;
  $form['label'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Label'),
    '#maxlength' => 255,
    '#default_value' => $event_type
      ->label(),
    '#description' => $this
      ->t("Label for the Event type."),
    '#required' => TRUE,
  ];
  $form['id'] = [
    '#type' => 'machine_name',
    '#default_value' => $event_type
      ->id(),
    '#machine_name' => [
      'exists' => '\\Drupal\\event\\Entity\\EventType::load',
    ],
    '#disabled' => !$event_type
      ->isNew(),
  ];

  /** TODO: Implement. By default with the core patch, timezones are always available
      $form['timezone'] = [
        '#title' => $this->t('Allow content to use custom timezones'),
        '#type' => 'checkbox',
        '#default_value' => $event_type->useTimezones(),
        '#description' => $this->t('Enable timezones on a per event basis.'),
      ];
       */
  return $form;
}