You are here

public function BookingConfirmationForm::buildForm in Booking and Availability Management Tools for Drupal 8

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides FormInterface::buildForm

File

modules/bat_booking/bat_booking_example/src/Form/BookingConfirmationForm.php, line 33
Contains \Drupal\bat_booking_example\Form\BookingConfirmationForm.

Class

BookingConfirmationForm

Namespace

Drupal\bat_booking_example\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $start_date = NULL, $end_date = NULL, $type_id = NULL) {
  $form['start_date'] = [
    '#type' => 'hidden',
    '#value' => $start_date
      ->format('Y-m-d'),
  ];
  $form['end_date'] = [
    '#type' => 'hidden',
    '#value' => $end_date
      ->format('Y-m-d'),
  ];
  $form['type_id'] = [
    '#type' => 'hidden',
    '#value' => $type_id,
  ];
  $form['submit'] = [
    '#type' => 'submit',
    '#value' => 'Confirm booking',
  ];
  return $form;
}