You are here

public function AdvbanDeleteAll::buildForm in Advanced ban 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/AdvbanDeleteAll.php, line 51

Class

AdvbanDeleteAll
Provides a form to unban IP addresses.

Namespace

Drupal\advban\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = [];
  $form['advban_delete_range'] = [
    '#title' => $this
      ->t('Delete all simple/range IP'),
    '#options' => [
      'all' => $this
        ->t('Delete all'),
      'simple' => $this
        ->t('Delete all simple IP only'),
      'range' => $this
        ->t('Delete all range IP only'),
    ],
    '#type' => 'radios',
    '#required' => TRUE,
  ];
  $form['advban_delete_expire'] = [
    '#title' => $this
      ->t('Delete all expired IP'),
    '#options' => [
      'all' => $this
        ->t('Delete all'),
      'expired' => $this
        ->t('Delete expired IP only'),
      'not_expired' => $this
        ->t('Delete not expired IP only'),
    ],
    '#type' => 'radios',
    '#required' => TRUE,
  ];
  $form['actions'] = [
    '#type' => 'actions',
  ];
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Delete'),
  ];
  return $form;
}