You are here

public function RegcodeAdminManageForm::buildForm in Registration codes 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

src/Form/RegcodeAdminManageForm.php, line 23

Class

RegcodeAdminManageForm
Form for managing registration codes.

Namespace

Drupal\regcode\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = [];
  $operations = [
    REGCODE_CLEAN_TRUNCATE => $this
      ->t('Delete all registration codes'),
    REGCODE_CLEAN_EXPIRED => $this
      ->t('Delete all expired codes'),
    REGCODE_CLEAN_INACTIVE => $this
      ->t('Delete all inactive codes'),
  ];
  $form['regcode_operations'] = [
    '#type' => 'checkboxes',
    '#title' => $this
      ->t('Operations'),
    '#description' => $this
      ->t('This operation cannot be undone.'),
    '#options' => $operations,
  ];
  $form['regcode_submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Perform operations'),
  ];
  return $form;
}