diff --git a/core/includes/form.inc b/core/includes/form.inc index e0de603..c8d7f33 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -2578,6 +2578,9 @@ function template_preprocess_form(&$variables) { $title = FormElementHelper::getElementTitle($element); $error_links[] = l($title, '', array('fragment' => 'edit-' . str_replace('_', '-', $key), 'external' => TRUE)); } + else { + drupal_set_message($error, 'error'); + } } if (!empty($error_links)) { diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php index a75df04..1269569 100644 --- a/core/lib/Drupal/Core/Form/FormBuilder.php +++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -1243,9 +1243,6 @@ public function setErrorByName($name, array &$form_state, $message = '') { if ($record) { $form_state['errors'][$name] = $message; $this->request->attributes->set('_form_errors', TRUE); - if ($message) { - $this->drupalSetMessage($message, 'error'); - } } } @@ -1773,15 +1770,6 @@ protected function watchdog($type, $message, array $variables = NULL, $severity } /** - * Wraps drupal_set_message(). - * - * @return array|null - */ - protected function drupalSetMessage($message = NULL, $type = 'status', $repeat = FALSE) { - return drupal_set_message($message, $type, $repeat); - } - - /** * Wraps drupal_html_class(). * * @return string diff --git a/core/tests/Drupal/Tests/Core/Form/FormTestBase.php b/core/tests/Drupal/Tests/Core/Form/FormTestBase.php index 3b7a97f..992995d 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormTestBase.php +++ b/core/tests/Drupal/Tests/Core/Form/FormTestBase.php @@ -287,12 +287,6 @@ protected function menuGetItem() { /** * {@inheritdoc} */ - protected function drupalSetMessage($message = NULL, $type = 'status', $repeat = FALSE) { - } - - /** - * {@inheritdoc} - */ protected function watchdog($type, $message, array $variables = NULL, $severity = WATCHDOG_NOTICE, $link = NULL) { }