You are here

public function CommonSettingsPageForm::buildForm in Multiple Registration 8.2

Same name and namespace in other branches
  1. 8 src/Form/CommonSettingsPageForm.php \Drupal\multiple_registration\Form\CommonSettingsPageForm::buildForm()
  2. 3.x src/Form/CommonSettingsPageForm.php \Drupal\multiple_registration\Form\CommonSettingsPageForm::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

src/Form/CommonSettingsPageForm.php, line 91

Class

CommonSettingsPageForm
Class CommonSettingsPageForm.

Namespace

Drupal\multiple_registration\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('multiple_registration.common_settings_page_form_config');
  $form['disable_main_register_page'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Disable main registration page'),
    '#description' => $this
      ->t('Indicates whether main registration page will be accessible to anonymous user.'),
    '#default_value' => $config
      ->get('multiple_registration_disable_main'),
  ];
  $form['enable_redirect_to_user_profile_when_user_logged_in'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable redirect to the user profile page for authenticated users'),
    '#description' => $this
      ->t('Enables redirection to the user profile page when the user is logged in and tries to click on the registration link.'),
    '#default_value' => $config
      ->get('enable_redirect_to_user_profile_when_user_logged_in'),
  ];
  $form['save'] = [
    '#type' => 'submit',
    '#attributes' => [
      'class' => [
        'button--primary',
      ],
    ],
    '#value' => $this
      ->t('Save'),
  ];
  $form['do_nothing'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Cancel'),
  ];
  return $form;
}