diff --git a/includes/form.theme b/includes/form.theme index a9637049b081141bf52dd9b867cb4cfbd903498d..e3ad6bbbf7d1c2a4d0f071c4c3b70e8fde6d8fc6 100644 --- a/includes/form.theme +++ b/includes/form.theme @@ -9,7 +9,6 @@ declare(strict_types=1); use Drupal\Component\Utility\Crypt; use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Render\Element; /** * Implements hook_form_FORM_ID_alter() for "node_preview_form_select". @@ -59,6 +58,16 @@ function dsfr4drupal_preprocess_form(array &$variables): void { } } +/** + * Implements hook_preprocess_HOOK() for "webform". + */ +function dsfr4drupal_preprocess_webform(array &$variables): void { + // Disable browser validation of form fields. + if (theme_get_setting('form_novalidate')) { + $variables['attributes']['novalidate'] = 'novalidate'; + } +} + /** * Implements hook_preprocess_HOOK() for "form_element". */