You are here

public function TourBuilderCloneForm::form in Tour Builder 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/TourBuilderCloneForm.php, line 47

Class

TourBuilderCloneForm
Form controller for the tour entity clone form.

Namespace

Drupal\tour_builder\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $form['label'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Tour name'),
    '#required' => TRUE,
    '#default_value' => $this->entity
      ->label(),
  ];
  $form['old_name'] = [
    '#type' => 'value',
    '#value' => $this->entity
      ->getOriginalId(),
  ];
  $form['new_name'] = [
    '#title' => 'File name for new tour item.',
    '#type' => 'textfield',
    '#description' => $this
      ->t('This value should start with <strong>tour.tour.</strong> and may not exists.'),
    '#field_prefix' => 'tour.tour.',
    '#default_value' => $this->entity
      ->getOriginalId(),
  ];
  $form['module'] = [
    '#title' => 'Module for this tour.',
    '#type' => 'textfield',
    '#default_value' => $this->entity
      ->getModule(),
  ];
  return $form;
}