diff --git a/core/modules/user/src/Tests/Views/HandlerFieldRoleTest.php b/core/modules/user/src/Tests/Views/HandlerFieldRoleTest.php index 0072d67..83df637 100644 --- a/core/modules/user/src/Tests/Views/HandlerFieldRoleTest.php +++ b/core/modules/user/src/Tests/Views/HandlerFieldRoleTest.php @@ -42,8 +42,6 @@ public function testRole() { $user->addRole($rolename_b); $user->save(); - debug(db_query('SELECT * FROM {user__roles}')->fetchAll()); - $view = Views::getView('test_views_handler_field_role'); $this->executeView($view); // The role field is populated during preRender. 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..b34caf8 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 \Drupal::service('renderer')->renderRoot($build); } } diff --git a/core/modules/views/templates/views-view-field.html.twig b/core/modules/views/templates/views-view-field.html.twig index a058548..04a20ac 100644 --- a/core/modules/views/templates/views-view-field.html.twig +++ b/core/modules/views/templates/views-view-field.html.twig @@ -3,10 +3,6 @@ * @file * Default theme implementation for a single field in a view. * - * It is not actually used in default views, as this is registered as a theme - * function which has better performance. For single overrides, the template is - * perfectly okay. - * * Available variables: * - view: The view that the field belongs to. * - field: The field handler that can process the input. @@ -24,4 +20,4 @@ * @ingroup themeable */ #} -{{ output }} +{{ output -}} diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 22424a1..6d811e5 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -133,7 +133,6 @@ function views_theme($existing, $type, $theme, $path) { // Default view themes $hooks['views_view_field'] = $base + array( 'variables' => array('view' => NULL, 'field' => NULL, 'row' => NULL), - 'function' => 'theme_views_view_field', ); $hooks['views_view_grouping'] = $base + array( 'variables' => array('view' => NULL, 'grouping' => NULL, 'grouping_level' => NULL, 'rows' => NULL, 'title' => NULL), diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc index f34d076..a6a5f8b 100644 --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -250,19 +250,6 @@ function template_preprocess_views_view_grouping(&$variables) { } /** - * Display a single views field. - * - * Interesting bits of info: - * $field->field_alias says what the raw value in $row will be. Reach it like - * this: @code { $row->{$field->field_alias} @endcode - * - * @ingroup themeable - */ -function theme_views_view_field($variables) { - return $variables['output']; -} - -/** * Prepares variables for views field templates. * * Default template: views-view-field.html.twig. diff --git a/core/modules/views_ui/src/Tests/CustomBooleanTest.php b/core/modules/views_ui/src/Tests/CustomBooleanTest.php index 08fbda8..9d050f1 100644 --- a/core/modules/views_ui/src/Tests/CustomBooleanTest.php +++ b/core/modules/views_ui/src/Tests/CustomBooleanTest.php @@ -109,4 +109,3 @@ public function testCustomOption() { } } -