diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php index 55159c2..1e9a2d5 100644 --- a/core/lib/Drupal/Core/Form/FormBuilder.php +++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -830,8 +830,8 @@ public function validateForm($form_id, &$form, &$form_state) { } // Ensure the correct protocol when #https is set. - if (!empty($form['#https']) && !\Drupal::request()->isSecure() && Settings::get('mixed_mode_sessions', FALSE)) { - \Drupal::formBuilder()->setErrorByName('', $form_state, t('This form must be submitted over a secure connection.')); + if (!empty($form['#https']) && !$this->request()->isSecure() && Settings::get('mixed_mode_sessions', FALSE)) { + $this->setErrorByName('', $form_state, t('This form must be submitted over a secure connection.')); } // Recursively validate each form element.