You are here

public function SocialUserFloodForm::buildForm in Open Social 8.2

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_user/src/Form/SocialUserFloodForm.php \Drupal\social_user\Form\SocialUserFloodForm::buildForm()
  2. 8 modules/social_features/social_user/src/Form/SocialUserFloodForm.php \Drupal\social_user\Form\SocialUserFloodForm::buildForm()
  3. 8.3 modules/social_features/social_user/src/Form/SocialUserFloodForm.php \Drupal\social_user\Form\SocialUserFloodForm::buildForm()
  4. 8.4 modules/social_features/social_user/src/Form/SocialUserFloodForm.php \Drupal\social_user\Form\SocialUserFloodForm::buildForm()
  5. 8.5 modules/social_features/social_user/src/Form/SocialUserFloodForm.php \Drupal\social_user\Form\SocialUserFloodForm::buildForm()
  6. 8.6 modules/social_features/social_user/src/Form/SocialUserFloodForm.php \Drupal\social_user\Form\SocialUserFloodForm::buildForm()
  7. 8.7 modules/social_features/social_user/src/Form/SocialUserFloodForm.php \Drupal\social_user\Form\SocialUserFloodForm::buildForm()
  8. 8.8 modules/social_features/social_user/src/Form/SocialUserFloodForm.php \Drupal\social_user\Form\SocialUserFloodForm::buildForm()
  9. 10.3.x modules/social_features/social_user/src/Form/SocialUserFloodForm.php \Drupal\social_user\Form\SocialUserFloodForm::buildForm()
  10. 10.0.x modules/social_features/social_user/src/Form/SocialUserFloodForm.php \Drupal\social_user\Form\SocialUserFloodForm::buildForm()
  11. 10.1.x modules/social_features/social_user/src/Form/SocialUserFloodForm.php \Drupal\social_user\Form\SocialUserFloodForm::buildForm()
  12. 10.2.x modules/social_features/social_user/src/Form/SocialUserFloodForm.php \Drupal\social_user\Form\SocialUserFloodForm::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

modules/social_features/social_user/src/Form/SocialUserFloodForm.php, line 34

Class

SocialUserFloodForm
Class SocialUserFloodForm.

Namespace

Drupal\social_user\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  // Get config for this form.
  $config = $this
    ->config('user.flood');
  $form['ip_limit'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('IP limit'),
    '#description' => $this
      ->t('The amount of login attempts that can be made from a certain IP address.'),
    '#default_value' => $config
      ->get('ip_limit'),
    '#min' => 0,
    '#step' => 10,
  ];
  $form['ip_window'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('IP window'),
    '#description' => $this
      ->t('The time in seconds that needs to pass before a login block expires (IP).'),
    '#default_value' => $config
      ->get('ip_window'),
    '#min' => 0,
    '#step' => 60,
  ];
  $form['user_limit'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('User limit'),
    '#description' => $this
      ->t('The amount of login attempts that can be made by a username.'),
    '#default_value' => $config
      ->get('user_limit'),
    '#min' => 0,
    '#step' => 1,
  ];
  $form['user_window'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('User window'),
    '#description' => $this
      ->t('The time in seconds that needs to pass before a login block expires (User).'),
    '#default_value' => $config
      ->get('user_window'),
    '#min' => 0,
    '#step' => 60,
  ];

  // TODO: Change the autogenerated stub.
  return parent::buildForm($form, $form_state);
}