diff --git a/core/includes/file.inc b/core/includes/file.inc index dec3188..e6602fc 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -1077,9 +1077,7 @@ function file_save_upload($source, $validators = array(), $destination = FALSE, if (isset($delta)) { return $upload_cache[$source][$delta]; } - else { - return $upload_cache[$source]; - } + return $upload_cache[$source]; } // Make sure there's an upload to process. @@ -1152,8 +1150,8 @@ function file_save_upload($source, $validators = array(), $destination = FALSE, } if (!empty($extensions)) { - // Munge the filename to protect against possible malicious extension hiding - // within an unknown file type (ie: filename.html.foo). + // Munge the filename to protect against possible malicious extension + // hiding within an unknown file type (ie: filename.html.foo). $file->filename = file_munge_filename($file->filename, $extensions); } diff --git a/core/modules/file/file.field.inc b/core/modules/file/file.field.inc index 2b32b38..66089be 100644 --- a/core/modules/file/file.field.inc +++ b/core/modules/file/file.field.inc @@ -421,7 +421,7 @@ function file_field_widget_multiple_count_validate($element, &$form_state, $form } drupal_set_message( t( - 'Field %field can hold only @max values. Only @count values were uploaded. The following files have been ommited: %list.', + 'Field %field can only hold @max values but there were @count uploaded. The following files have been omitted as a result: %list.', array( '%field' => $field['field_name'], '@max' => $field['cardinality'], @@ -607,8 +607,9 @@ function file_field_widget_submit($form, &$form_state) { } } - // If there are more files uploaded via same widget, we have to - // separate them, as we display each file in it's own widget. + // If there are more files uploaded via the same widget, we + // have to separate them, as we display each file in it's + // own widget. $new_values = array(); foreach ($submitted_values as $delta => $submitted_value) { foreach ($submitted_value['fids'] as $fid) { diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 43adc9d..95b85a6 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -1094,9 +1094,6 @@ function file_managed_file_validate(&$element, &$form_state) { // item were to be deleted. $clicked_button = end($form_state['triggering_element']['#parents']); if ($clicked_button != 'remove_button' && !empty($element['fids']['#value'])) { - // Was here but I do not see any sense in it anymore. Leaving here for reference if any - // strange bugs occur during development of the patch. - //$fids = is_array($element['fids']['#value']) ? $element['fids']['#value'] : explode(' ', $element['fids']['#value']); $fids = $element['fids']['#value']; foreach ($fids as $fid) { if ($file = file_load($fid)) { diff --git a/core/modules/file/lib/Drupal/file/Plugin/field/widget/FileWidget.php b/core/modules/file/lib/Drupal/file/Plugin/field/widget/FileWidget.php index 52113ce..647b025 100644 --- a/core/modules/file/lib/Drupal/file/Plugin/field/widget/FileWidget.php +++ b/core/modules/file/lib/Drupal/file/Plugin/field/widget/FileWidget.php @@ -212,7 +212,7 @@ public function formElement(array $items, $delta, array $element, $langcode, arr */ public function massageFormValues(array $values, array $form, array &$form_state) { // Since file upload widget now supports uploads of more than one file at - // the time it always returns array of fids. We have to translate this to + // a time it always returns an array of fids. We have to translate this to // a single fid, as field expects single value. $new_values = array(); foreach ($values as &$value) {