diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php index 152d4e9..5767789 100644 --- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php +++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php @@ -1306,7 +1306,7 @@ public function renderText($alter) { // Preserve whether or not the string is safe. Since $suffix comes from // \Drupal::l(), it is safe to append. - if ($value_is_safe) { + if ($value_is_safe || $value instanceof SafeStringInterface) { return ViewsRenderPipelineSafeString::create($value . $suffix); } else { @@ -1544,7 +1544,9 @@ protected function renderAsLink($alter, $text, $tokens) { $value .= Xss::filterAdmin($this->viewsTokenReplace($alter['suffix'], $tokens)); } - return $value; + // Preserve whether or not the string is safe. Since 'prefix' and 'suffix' + // comes are Xss admin filtered and \Drupal::l(), it is safe to append. + return ViewsRenderPipelineSafeString::create($value); } /** diff --git a/core/modules/views/src/Plugin/views/field/PrerenderList.php b/core/modules/views/src/Plugin/views/field/PrerenderList.php index ce0caee..a55250b 100644 --- a/core/modules/views/src/Plugin/views/field/PrerenderList.php +++ b/core/modules/views/src/Plugin/views/field/PrerenderList.php @@ -7,6 +7,7 @@ namespace Drupal\views\Plugin\views\field; +use Drupal\Component\Utility\Xss; use Drupal\Core\Form\FormStateInterface; use Drupal\views\ResultRow; @@ -78,17 +79,23 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { public function renderItems($items) { if (!empty($items)) { if ($this->options['type'] == 'separator') { - return implode($this->sanitizeValue($this->options['separator'], 'xss_admin'), $items); + $separator = Xss::filterAdmin($this->options['separator']); + $build = [ + '#type' => 'inline_template', + '#template' => '{{ items | safe_join(separator) }}', + '#context' => ['separator' => $separator, 'items' => $items], + ]; } else { - $item_list = array( + $build = array( '#theme' => 'item_list', '#items' => $items, '#title' => NULL, '#list_type' => $this->options['type'], ); - return drupal_render($item_list); } + + return $this->renderer->render($build); } }