diff --git a/core/modules/color/color.module b/core/modules/color/color.module index 7d7d37e..1d6b406 100644 --- a/core/modules/color/color.module +++ b/core/modules/color/color.module @@ -333,7 +333,7 @@ function color_scheme_form_validate($form, &$form_state) { // Only accept hexadecimal CSS color strings to avoid XSS upon use. foreach ($form_state['values']['palette'] as $key => $color) { if (!color_valid_hexadecimal_string($color)) { - \Drupal::formBuilder()->setErrorByName('palette][' . $key, $form_state, t('You must enter a valid hexadecimal color value for %name.', array('%name' => $form['color']['palette'][$key]['#title']))); + \Drupal::formBuilder()->setErrorByName('palette][' . $key, $form_state, t('You must enter a valid hexadecimal color value for %name.', array('%name' => $form['color']['palette'][$key]['#title']))); } } } diff --git a/core/modules/content_translation/content_translation.admin.inc b/core/modules/content_translation/content_translation.admin.inc index 0dea8e2..8871f4d 100644 --- a/core/modules/content_translation/content_translation.admin.inc +++ b/core/modules/content_translation/content_translation.admin.inc @@ -272,7 +272,7 @@ function content_translation_form_language_content_settings_validate(array $form foreach (\Drupal::languageManager()->getLanguages(LanguageInterface::STATE_LOCKED) as $language) { $locked_languages[] = $language->name; } - \Drupal::formBuilder()->setErrorByName($name, $form_state, t('Translation is not supported if language is always one of: @locked_languages', array('@locked_languages' => implode(', ', $locked_languages)))); + \Drupal::formBuilder()->setErrorByName($name, $form_state, t('Translation is not supported if language is always one of: @locked_languages', array('@locked_languages' => implode(', ', $locked_languages)))); } } } diff --git a/core/modules/system/tests/modules/form_test/src/Callbacks.php b/core/modules/system/tests/modules/form_test/src/Callbacks.php index 43ed78c..8cee4c5 100644 --- a/core/modules/system/tests/modules/form_test/src/Callbacks.php +++ b/core/modules/system/tests/modules/form_test/src/Callbacks.php @@ -44,7 +44,7 @@ public function validateName(&$element, &$form_state) { drupal_set_message(t('@label value: @value', array('@label' => $element['#title'], '@value' => $form_state['values']['name']))); // Trigger a form validation error to see our changes. - \Drupal::formBuilder()->setErrorByName('', $form_state, ''); + \Drupal::formBuilder()->setErrorByName('', $form_state); } } diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestProgrammaticForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestProgrammaticForm.php index a44b8c4..4a8b4e5 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestProgrammaticForm.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestProgrammaticForm.php @@ -89,7 +89,7 @@ public function buildForm(array $form, array &$form_state) { */ public function validateForm(array &$form, array &$form_state) { if (empty($form_state['values']['textfield'])) { - form_set_error('textfield', $form_state, t('Textfield is required.')); + \Drupal::formBuilder()->setErrorByName('textfield', $form_state, t('Textfield is required.')); } } diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestValidateForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestValidateForm.php index 2e59a75..b38a3d0 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestValidateForm.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestValidateForm.php @@ -68,7 +68,7 @@ public function validateForm(array &$form, array &$form_state) { drupal_set_message(t('@label value: @value', array('@label' => $form['name']['#title'], '@value' => $form_state['values']['name']))); // Trigger a form validation error to see our changes. - form_set_error('', $form_state); + \Drupal::formBuilder()->setErrorByName('', $form_state); } } diff --git a/core/modules/user/user.module b/core/modules/user/user.module index c49b95d..8f9dd05 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -532,7 +532,7 @@ function user_validate_current_pass(&$form, &$form_state) { $current_pass_failed = empty($form_state['values']['current_pass']) || !\Drupal::service('password')->check($form_state['values']['current_pass'], $account); if ($current_pass_failed) { \Drupal::formBuilder()->setErrorByName('current_pass', $form_state, t("Your current password is missing or incorrect; it's required to change the %name.", array('%name' => $name))); - \Drupal::formBuilder()->setErrorByName($key, $form_state, ''); + \Drupal::formBuilder()->setErrorByName($key, $form_state); } // We only need to check the password once. break;