You are here

public function PerimeterSettingsForm::buildForm in Drupal Perimeter Defence 2.0.x

Same name and namespace in other branches
  1. 8 src/Form/PerimeterSettingsForm.php \Drupal\perimeter\Form\PerimeterSettingsForm::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/PerimeterSettingsForm.php, line 39
Contains Drupal\perimeter\Form\PerimeterSettingsForm.

Class

PerimeterSettingsForm
Class PerimeterSettingsForm.

Namespace

Drupal\perimeter\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('perimeter.settings');
  $form['message'] = [
    '#type' => 'html_tag',
    '#tag' => 'h3',
    '#value' => $this
      ->t('Perimeter will ban any user that generates "404 - File not found" for requesting any of the following url pattern'),
  ];
  $form['not_found_exception_patterns'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Ban URL patterns'),
    '#default_value' => implode("\n", $config
      ->get('not_found_exception_patterns')),
    '#description' => $this
      ->t('A list of regex patterns, each pattern on a separate line'),
    '#required' => TRUE,
  ];
  return parent::buildForm($form, $form_state);
}