You are here

public function EventMaxEnrollSettingsForm::buildForm in Open Social 8.9

Same name and namespace in other branches
  1. 8.5 modules/social_features/social_event/modules/social_event_max_enroll/src/Form/EventMaxEnrollSettingsForm.php \Drupal\social_event_max_enroll\Form\EventMaxEnrollSettingsForm::buildForm()
  2. 8.6 modules/social_features/social_event/modules/social_event_max_enroll/src/Form/EventMaxEnrollSettingsForm.php \Drupal\social_event_max_enroll\Form\EventMaxEnrollSettingsForm::buildForm()
  3. 8.7 modules/social_features/social_event/modules/social_event_max_enroll/src/Form/EventMaxEnrollSettingsForm.php \Drupal\social_event_max_enroll\Form\EventMaxEnrollSettingsForm::buildForm()
  4. 8.8 modules/social_features/social_event/modules/social_event_max_enroll/src/Form/EventMaxEnrollSettingsForm.php \Drupal\social_event_max_enroll\Form\EventMaxEnrollSettingsForm::buildForm()
  5. 10.3.x modules/social_features/social_event/modules/social_event_max_enroll/src/Form/EventMaxEnrollSettingsForm.php \Drupal\social_event_max_enroll\Form\EventMaxEnrollSettingsForm::buildForm()
  6. 10.0.x modules/social_features/social_event/modules/social_event_max_enroll/src/Form/EventMaxEnrollSettingsForm.php \Drupal\social_event_max_enroll\Form\EventMaxEnrollSettingsForm::buildForm()
  7. 10.1.x modules/social_features/social_event/modules/social_event_max_enroll/src/Form/EventMaxEnrollSettingsForm.php \Drupal\social_event_max_enroll\Form\EventMaxEnrollSettingsForm::buildForm()
  8. 10.2.x modules/social_features/social_event/modules/social_event_max_enroll/src/Form/EventMaxEnrollSettingsForm.php \Drupal\social_event_max_enroll\Form\EventMaxEnrollSettingsForm::buildForm()

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 ConfigFormBase::buildForm

File

modules/social_features/social_event/modules/social_event_max_enroll/src/Form/EventMaxEnrollSettingsForm.php, line 32

Class

EventMaxEnrollSettingsForm
Class EventMaxEnrollSettingsForm.

Namespace

Drupal\social_event_max_enroll\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $event_max_enroll_config = $this
    ->config('social_event_max_enroll.settings');
  $form['max_enroll'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable maximum number of event enrollments'),
    '#description' => $this
      ->t('Enabling this feature provides event organisers with the possibility to set a limit for event enrollments.'),
    '#default_value' => $event_max_enroll_config
      ->get('max_enroll'),
  ];
  $form['max_enroll_required'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Maximum event enrollments field is required'),
    '#default_value' => $event_max_enroll_config
      ->get('max_enroll_required'),
    '#states' => [
      'visible' => [
        'input[name="max_enroll"]' => [
          'checked' => TRUE,
        ],
      ],
    ],
  ];
  return parent::buildForm($form, $form_state);
}