diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 6015041..db8b4e6 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -481,7 +481,9 @@ function template_preprocess_datetime_wrapper(&$variables) { $variables['title'] = $element['#title']; } - if (!empty($element['#errors'])) { + // Display any error messages. + $variables['errors'] = NULL; + if (!empty($element['#errors']) && empty($element['#error_no_message'])) { $variables['errors'] = $element['#errors']; } diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 9c1a2f2..ee12a41 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -1149,7 +1149,7 @@ function file_managed_file_save_upload($element, FormStateInterface $form_state) $destination = isset($element['#upload_location']) ? $element['#upload_location'] : NULL; if (isset($destination) && !file_prepare_directory($destination, FILE_CREATE_DIRECTORY)) { \Drupal::logger('file')->notice('The upload directory %directory for the file field !name could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.', array('%directory' => $destination, '!name' => $element['#field_name'])); - $form_state->setError($element, t('The file could not be uploaded.')); + $form_state->setErrorByName($upload_name, t('The file could not be uploaded.')); return FALSE; } @@ -1159,7 +1159,7 @@ function file_managed_file_save_upload($element, FormStateInterface $form_state) if ($files_uploaded) { if (!$files = file_save_upload($upload_name, $element['#upload_validators'], $destination)) { \Drupal::logger('file')->notice('The file upload failed. %upload', array('%upload' => $upload_name)); - $form_state->setError($element, t('Files in the !name field were unable to be uploaded.', array('!name' => $element['#title']))); + $form_state->setErrorByName($upload_name, t('Files in the !name field were unable to be uploaded.', array('!name' => $element['#title']))); return array(); } diff --git a/core/modules/shortcut/src/Form/SwitchShortcutSet.php b/core/modules/shortcut/src/Form/SwitchShortcutSet.php index 0880946..5388db5 100644 --- a/core/modules/shortcut/src/Form/SwitchShortcutSet.php +++ b/core/modules/shortcut/src/Form/SwitchShortcutSet.php @@ -115,7 +115,9 @@ public function buildForm(array $form, FormStateInterface $form_state, UserInter // This ID could be used for menu name. '#maxlength' => 23, '#states' => array( - 'required' => [':input[name="set"]' => ['value' => 'new']], + 'required' => array( + ':input[name="set"]' => array('value' => 'new'), + ), ), '#required' => FALSE, );