public function AntibotSettings::buildForm in Antibot 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 ConfigFormBase::buildForm
File
- src/
Form/ AntibotSettings.php, line 34
Class
- AntibotSettings
- Class AntibotSettings.
Namespace
Drupal\antibot\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('antibot.settings');
$form['message'] = [
'#type' => 'html_tag',
'#tag' => 'h3',
'#value' => $this
->t('Antibot requires that a user has JavaScript enabled in order to use and submit a given form.'),
];
$form['form_ids'] = [
'#type' => 'textarea',
'#title' => $this
->t('Form IDs'),
'#default_value' => implode("\r\n", $config
->get('form_ids')),
'#description' => $this
->t('Specify the form IDs that should be protected by Antibot. Each form ID should be on a separate line. Wildcard (*) characters can be used.'),
];
$form['show_form_ids'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Display form IDs'),
'#default_value' => $config
->get('show_form_ids'),
'#description' => $this
->t('When enabled, the form IDs of all forms on every page will be displayed to any user with permission to access these settings. Also displayed will be whether or not Antibot is enabled for each form. This should only be turned on temporarily in order to easily determine the form IDs to use.'),
];
return parent::buildForm($form, $form_state);
}