diff -u b/core/includes/theme.inc b/core/includes/theme.inc
--- b/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -13,10 +13,8 @@
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Unicode;
-use Drupal\Component\Utility\Xss;
use Drupal\Core\Config\Config;
use Drupal\Core\Config\StorageException;
-use Drupal\Core\Render\SafeString;
use Drupal\Core\Template\Attribute;
use Drupal\Core\Theme\ThemeSettings;
use Drupal\Component\Utility\NestedArray;
@@ -1067,25 +1065,6 @@
}
/**
- * Prepares variables for inline list templates.
- *
- * Default template: inline-list.html.twig.
- *
- * @param array $variables
- * An associative array containing:
- * - items: An array of items to be displayed in the list.
- * - separator: A string to separate list items.
- * - empty: A message to display when there are no items.
- *
- * @see https://www.drupal.org/node/1842756
- */
-function template_preprocess_inline_list(&$variables) {
- // Since the separator may be user-specified, it must be filtered to permit
- // some HTML (such as
) to pass through.
- $variables['separator'] = SafeString::create(Xss::filter($variables['separator'], ['br']));
-}
-
-/**
* Returns HTML for an indentation div; used for drag and drop tables.
*
* @param $variables
@@ -1750,8 +1729,8 @@
'item_list' => array(
'variables' => array('items' => array(), 'title' => '', 'list_type' => 'ul', 'attributes' => array(), 'empty' => NULL, 'context' => array()),
),
- 'inline_list' => array(
- 'variables' => array('items' => array(), 'separator' => ', ', 'attributes' => array(), 'empty' => NULL),
+ 'comma_list' => array(
+ 'variables' => array('items' => array()),
),
'feed_icon' => array(
'variables' => array('url' => NULL, 'title' => NULL),
diff -u b/core/modules/system/src/Tests/Theme/FunctionsTest.php b/core/modules/system/src/Tests/Theme/FunctionsTest.php
--- b/core/modules/system/src/Tests/Theme/FunctionsTest.php
+++ b/core/modules/system/src/Tests/Theme/FunctionsTest.php
@@ -168,47 +168,19 @@
}
/**
- * Tests inline-list.html.twig.
+ * Tests comma-list.html.twig.
*/
- function testInlineList() {
+ function testCommaList() {
// Verify that empty items produce no output.
$variables = array();
$expected = '';
- $this->assertThemeOutput('inline_list', $variables, $expected, 'Empty %callback generates no output.');
+ $this->assertThemeOutput('comma_list', $variables, $expected, 'Empty %callback generates no output.');
- // Verify that empty items produce the empty string.
+ // Verify that elements are correctly delimited by commas.
$variables = array();
- $variables['empty'] = 'No items found.';
- $expected = 'No items found.';
- $this->assertThemeOutput('inline_list', $variables, $expected, 'Empty %callback generates empty string.');
-
- // Verify that empty text is not displayed when there are list items.
- $variables = array();
- $variables['empty'] = 'No items found.';
$variables['items'] = array('Rabbit', 'rabbit', 'rabbit');
$expected = 'Rabbit, rabbit, rabbit';
- $this->assertThemeOutput('inline_list', $variables, $expected, '%callback does not print empty text when there are list items.');
-
- // Verify that a non-default separator is rendered.
- $variables = array();
- $variables['items'] = array('Un', 'Deux', 'Trois');
- $variables['separator'] = ' and ';
- $expected = 'Un and Deux and Trois';
- $this->assertThemeOutput('inline_list', $variables, $expected, '%callback uses a custom separator when provided.');
-
- // Verify that HTML separators are properly rendered.
- $variables = array();
- $variables['items'] = array('Doe', 'Buck', 'Kit');
- $variables['separator'] = '
';
- $expected = 'Doe
Buck
Kit';
- $this->assertThemeOutput('inline_list', $variables, $expected, '%callback allows HTML in user-provided separators.');
-
- // Verify that the separator is sanitized.
- $variables = array();
- $variables['items'] = array('Un', 'Deux', 'Trois');
- $variables['separator'] = '';
- $expected = 'Unalert("test")Deuxalert("test")Trois';
- $this->assertThemeOutput('inline_list', $variables, $expected, '%callback sanitizes user-provided separators.');
+ $this->assertThemeOutput('comma_list', $variables, $expected, '%callback elements are correctly delimited by commas.');
}
/**
reverted:
--- b/core/modules/system/templates/inline-list.html.twig
+++ /dev/null
@@ -1,20 +0,0 @@
-{#
-/**
- * @file
- * Default theme implementation for an inline list of items.
- *
- * Available variables:
- * - items: A list of items.
- * - separator: A delimiter to separate the items in the list.
- * - empty: A message to display when there are no items.
- *
- * @see template_preprocess_inline_list()
- *
- * @ingroup themeable
- */
-#}
-{%- for item in items -%}
- {{ item }}{{ loop.last ? '' : separator }}
-{%- else -%}
- {{- empty -}}
-{%- endfor -%}
diff -u b/core/modules/views_ui/src/ViewListBuilder.php b/core/modules/views_ui/src/ViewListBuilder.php
--- b/core/modules/views_ui/src/ViewListBuilder.php
+++ b/core/modules/views_ui/src/ViewListBuilder.php
@@ -109,7 +109,7 @@
'tag' => $view->get('tag'),
'path' => array(
'data' => array(
- '#theme' => 'inline_list',
+ '#theme' => 'comma_list',
'#items' => $this->getDisplayPaths($view),
),
),
only in patch2:
unchanged:
--- /dev/null
+++ b/core/modules/system/templates/comma-list.html.twig
@@ -0,0 +1,14 @@
+{#
+/**
+ * @file
+ * Default theme implementation for a comma-delimited list of items.
+ *
+ * Available variable:
+ * - items: A list of items.
+ *
+ * @ingroup themeable
+ */
+#}
+{%- for item in items -%}
+ {{ item }}{{ loop.last ? '' : ', ' }}
+{%- endfor -%}