public function WebformDeterSettingsForm::buildForm in Webform Deter 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/ WebformDeterSettingsForm.php, line 35
Class
- WebformDeterSettingsForm
- Form to configure Webform Deter settings.
Namespace
Drupal\webform_deter\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('webform_deter.settings');
$form['warning_message'] = [
'#type' => 'textarea',
'#title' => $this
->t('Message'),
'#description' => $this
->t('The message shown to users when a deter pattern matches.'),
'#default_value' => $config
->get('warning_message') ?? self::DEFAULT_MESSAGE,
];
$form['patterns'] = [
'#type' => 'textarea',
'#title' => $this
->t('Patterns'),
'#description' => $this
->t("A new-line separated list of patterns to match against."),
'#default_value' => implode("\r\n", $config
->get('patterns') ?: []),
];
return parent::buildForm($form, $form_state);
}