You are here

public function DeleteRegistrationPageForm::buildForm in Multiple Registration 8.2

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

File

src/Form/DeleteRegistrationPageForm.php, line 53

Class

DeleteRegistrationPageForm
Class DeleteRegistrationPageForm.

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,
  ];
  $form['message'] = [
    '#markup' => '<p>' . $this
      ->t('Are you sure want to delete registration page for %role role?', [
      '%role' => $roles[$rid],
    ]) . '</p>',
  ];
  $form['dont_remove'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('No'),
  ];
  $form['remove'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Yes'),
  ];
  return $form;
}