public function CSSCaptchaSettingsForm::buildForm in CAPTCHA Pack 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
- css_captcha/
src/ Form/ CSSCaptchaSettingsForm.php, line 40
Class
- CSSCaptchaSettingsForm
- CSS CAPTCHA settings form.
Namespace
Drupal\css_captcha\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form = [];
$config = $this
->config('css_captcha.settings');
$form['css_captcha_allowed_characters'] = [
'#type' => 'textfield',
'#title' => $this
->t('Characters to use in the code'),
'#default_value' => $config
->get('css_captcha_allowed_characters'),
'#required' => TRUE,
];
$form['css_captcha_code_length'] = [
'#type' => 'select',
'#title' => $this
->t('Code length'),
'#options' => array_combine([
4,
5,
6,
7,
8,
9,
10,
], [
4,
5,
6,
7,
8,
9,
10,
]),
'#default_value' => $config
->get('css_captcha_code_length'),
];
return parent::buildForm($form, $form_state);
}