You are here

public function CreateRegistrationPageForm::buildForm in Multiple Registration 8

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

Class

CreateRegistrationPageForm
Class CreateRegistrationPageForm.

Namespace

Drupal\multiple_registration\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $rid = NULL) {
  if (!isset($rid)) {
    return FALSE;
  }
  $roles = user_role_names();
  if (!isset($roles[$rid])) {
    return FALSE;
  }
  $form['rid'] = [
    '#type' => 'value',
    '#value' => $rid,
  ];
  $config = $this
    ->config('multiple_registration.create_registration_page_form_config');
  $form['multiple_registration_path_' . $rid] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Registration page path'),
    '#description' => $this
      ->t('Path for registration page.'),
    '#default_value' => $config
      ->get('multiple_registration_path_' . $rid),
  ];
  $form['multiple_registration_hidden_' . $rid] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Hide registration form tab'),
    '#description' => $this
      ->t('Indicates whether form will be accessible only by url.'),
    '#default_value' => $config
      ->get('multiple_registration_hidden_' . $rid),
  ];
  $form['multiple_registration_url_' . $rid] = [
    '#type' => 'value',
    '#value' => MultipleRegistrationController::MULTIPLE_REGISTRATION_SIGNUP_PATH_PATTERN . $rid,
  ];
  return parent::buildForm($form, $form_state);
}