Unverified Commit 59eb794a authored by alexpott's avatar alexpott

Issue #2935360 by Lendude, Kirst25: Views result summary still renders when there's no results

parent ecadaba6
...@@ -115,11 +115,13 @@ public function render($empty = FALSE) { ...@@ -115,11 +115,13 @@ public function render($empty = FALSE) {
// Send the output. // Send the output.
if (!empty($total) || !empty($this->options['empty'])) { if (!empty($total) || !empty($this->options['empty'])) {
$output .= Xss::filterAdmin(str_replace(array_keys($replacements), array_values($replacements), $format)); $output .= Xss::filterAdmin(str_replace(array_keys($replacements), array_values($replacements), $format));
// Return as render array.
return [
'#markup' => $output,
];
} }
// Return as render array.
return [ return [];
'#markup' => $output,
];
} }
} }
...@@ -57,6 +57,7 @@ public function testResultEmpty() { ...@@ -57,6 +57,7 @@ public function testResultEmpty() {
$output = \Drupal::service('renderer')->renderRoot($output); $output = \Drupal::service('renderer')->renderRoot($output);
$this->setRawContent($output); $this->setRawContent($output);
$this->assertText('start: 0 | end: 0 | total: 0 | label: test_area_result | per page: 0 | current page: 1 | current record count: 0 | page count: 1'); $this->assertText('start: 0 | end: 0 | total: 0 | label: test_area_result | per page: 0 | current page: 1 | current record count: 0 | page count: 1');
$this->assertRaw('<header>');
// Test that the area is not displayed if we have not checked the empty // Test that the area is not displayed if we have not checked the empty
// checkbox. // checkbox.
...@@ -67,6 +68,8 @@ public function testResultEmpty() { ...@@ -67,6 +68,8 @@ public function testResultEmpty() {
$output = \Drupal::service('renderer')->renderRoot($output); $output = \Drupal::service('renderer')->renderRoot($output);
$this->setRawContent($output); $this->setRawContent($output);
$this->assertNoText('start: 0 | end: 0 | total: 0 | label: test_area_result | per page: 0 | current page: 1 | current record count: 0 | page count: 1'); $this->assertNoText('start: 0 | end: 0 | total: 0 | label: test_area_result | per page: 0 | current page: 1 | current record count: 0 | page count: 1');
// Make sure the empty header region isn't rendered.
$this->assertNoRaw('<header>');
} }
} }
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