You are here

public function AdvbanDelete::buildForm in Advanced ban 8

Parameters

array $form: Form variable.

Drupal\Core\Form\FormStateInterface $form_state: FormState variable.

string $ban_id: The IP address record ID to unban.

Overrides ConfirmFormBase::buildForm

File

src/Form/AdvbanDelete.php, line 96

Class

AdvbanDelete
Provides a form to unban IP addresses.

Namespace

Drupal\advban\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $ban_id = '') {
  $ip_info = $this->ipManager
    ->findById($ban_id);
  if (empty($ip_info)) {
    throw new NotFoundHttpException();
  }
  if (is_array($ip_info)) {
    $ip_info = reset($ip_info);
  }
  $this->banIp = $ip_info->ip;
  $this->banIpEnd = $ip_info->ip_end;
  return parent::buildForm($form, $form_state);
}