diff --git a/core/modules/file/file.field.inc b/core/modules/file/file.field.inc index f09760f..c7d16f5 100644 --- a/core/modules/file/file.field.inc +++ b/core/modules/file/file.field.inc @@ -6,7 +6,6 @@ */ use Drupal\Component\Utility\Html; -use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Render\Element; @@ -99,10 +98,6 @@ function template_preprocess_file_widget_multiple(&$variables) { // Render the previously hidden elements, using render() instead of // drupal_render(), to undo the earlier hide(). - $operations = ''; - foreach ($operations_elements as $operation_element) { - $operations .= render($operation_element); - } $display = ''; if ($element['#display_field']) { unset($widget['display']['#title']); @@ -121,7 +116,13 @@ function template_preprocess_file_widget_multiple(&$variables) { $row[] = $display; } $row[] = $weight; - $row[] = SafeMarkup::set($operations); + // If we have rendered the element once (multiple files) then we need to set #printed to false. + foreach (Element::children($operations_elements) as $key) { + show($operations_elements[$key]); + } + $row[] = array( + 'data' => $operations_elements, + ); $rows[] = array( 'data' => $row, 'class' => isset($widget['#attributes']['class']) ? array_merge($widget['#attributes']['class'], array('draggable')) : array('draggable'),