From 80b3daf90db40cb7071115fcb58e8fdd739d0c90 Mon Sep 17 00:00:00 2001 From: catch Date: Tue, 28 Mar 2023 11:00:35 +0100 Subject: [PATCH] Issue #2602326 by Rassoni, Rishabh Vishwakarma, heykarthikwithu, paulocs, borisson_, alexpott: Unused local variable $key (at line 49) in file.field.inc --- core/modules/file/file.field.inc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/modules/file/file.field.inc b/core/modules/file/file.field.inc index 15a465e3c3d..93a5ac2ffbe 100644 --- a/core/modules/file/file.field.inc +++ b/core/modules/file/file.field.inc @@ -20,7 +20,6 @@ use Drupal\Core\Render\Element; */ function template_preprocess_file_widget_multiple(&$variables) { $element = $variables['element']; - // Special ID and classes for draggable tables. $weight_class = $element['#id'] . '-weight'; $table_id = $element['#id'] . '-table'; @@ -46,7 +45,7 @@ function template_preprocess_file_widget_multiple(&$variables) { usort($widgets, '_field_multiple_value_form_sort_helper'); $rows = []; - foreach ($widgets as $key => &$widget) { + foreach ($widgets as &$widget) { // Save the uploading row for last. if (empty($widget['#files'])) { $widget['#title'] = $element['#file_upload_title']; @@ -57,10 +56,10 @@ function template_preprocess_file_widget_multiple(&$variables) { // Delay rendering of the buttons, so that they can be rendered later in the // "operations" column. $operations_elements = []; - foreach (Element::children($widget) as $sub_key) { - if (isset($widget[$sub_key]['#type']) && $widget[$sub_key]['#type'] == 'submit') { - hide($widget[$sub_key]); - $operations_elements[] = &$widget[$sub_key]; + foreach (Element::children($widget) as $key) { + if (isset($widget[$key]['#type']) && $widget[$key]['#type'] == 'submit') { + hide($widget[$key]); + $operations_elements[] = &$widget[$key]; } }