Commit ad64eddb authored by alexpott's avatar alexpott

Issue #2260059 by er.pushpinderrana, joelpittet, LinL, SebCorbin | Mark...

Issue #2260059 by er.pushpinderrana, joelpittet, LinL, SebCorbin | Mark Carver: Fixed Title in template_preprocess_item_list() is typecasted as string.
parent 3f3fc8db
......@@ -1755,8 +1755,6 @@ function template_preprocess_tablesort_indicator(&$variables) {
* @see http://drupal.org/node/1842756
*/
function template_preprocess_item_list(&$variables) {
$variables['title'] = (string) $variables['title'];
foreach ($variables['items'] as &$item) {
$attributes = array();
// If the item value is an array, then it is a render array.
......
......@@ -55,6 +55,23 @@ function testItemList() {
$expected = '<div class="item-list"><h3>Some title</h3>No items found.</div>';
$this->assertThemeOutput('item_list', $variables, $expected, 'Empty %callback generates empty string with title.');
// Verify that title set to 0 is output.
$variables = array();
$variables['title'] = 0;
$variables['empty'] = 'No items found.';
$expected = '<div class="item-list"><h3>0</h3>No items found.</div>';
$this->assertThemeOutput('item_list', $variables, $expected, '%callback with title set to 0 generates a title.');
// Verify that title set to a render array is output.
$variables = array();
$variables['title'] = array(
'#theme' => 'markup',
'#markup' => '<span>Render array</span>',
);
$variables['empty'] = 'No items found.';
$expected = '<div class="item-list"><h3><span>Render array</span></h3>No items found.</div>';
$this->assertThemeOutput('item_list', $variables, $expected, '%callback with title set to a render array generates a title.');
// Verify that empty text is not displayed when there are list items.
$variables = array();
$variables['title'] = 'Some title';
......
......@@ -20,7 +20,7 @@
#}
{%- if items or empty -%}
<div class="item-list">
{%- if title -%}
{%- if title is not empty -%}
<h3>{{ title }}</h3>
{%- endif -%}
{%- if items -%}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment