Permalink
Browse files

fix(views): no results listing output should show if empty item views

fixes #9917
  • Loading branch information...
jdalsem committed Sep 23, 2016
1 parent fbf52cb commit a3d4f8c81132cd34b8152d08b18d1bcd6cd2a2e3
@@ -24,11 +24,7 @@
$no_results = elgg_extract('no_results', $vars, '');
if (!$items && $no_results) {
if ($no_results instanceof Closure) {
echo $no_results();
return;
}
echo "<p class='elgg-no-results'>$no_results</p>";
echo elgg_view('page/components/no_results', $vars);
return;
}
@@ -72,7 +68,12 @@
echo $nav;
}
echo elgg_format_element('ul', ['class' => $list_classes], $list_items);
if (empty($list_items) && $no_results) {
// there are scenarios where item views do not output html. In those cases show the no results info
echo elgg_view('page/components/no_results', $vars);
} else {
echo elgg_format_element('ul', ['class' => $list_classes], $list_items);
}
if ($position == 'after' || $position == 'both') {
echo $nav;
@@ -26,11 +26,7 @@
$no_results = elgg_extract('no_results', $vars, '');
if (!$items && $no_results) {
if ($no_results instanceof Closure) {
echo $no_results();
return;
}
echo "<p class='elgg-no-results'>$no_results</p>";
echo elgg_view('page/components/no_results', $vars);
return;
}
@@ -81,7 +77,12 @@
echo $nav;
}
echo elgg_format_element('ul', ['class' => $list_classes], $list_items);
if (empty($list_items) && $no_results) {
// there are scenarios where item views do not output html. In those cases show the no results info
echo elgg_view('page/components/no_results', $vars);
} else {
echo elgg_format_element('ul', ['class' => $list_classes], $list_items);
}
if ($position == 'after' || $position == 'both') {
echo $nav;
@@ -0,0 +1,17 @@
<?php
/**
* No results view
*
* @uses $vars['no_results'] Message to display if no results (string|Closure)
*/
$no_results = elgg_extract('no_results', $vars);
if (empty($no_results)) {
return;
}
if ($no_results instanceof Closure) {
echo $no_results();
return;
}
echo "<p class='elgg-no-results'>$no_results</p>";

0 comments on commit a3d4f8c

Please sign in to comment.