Commit 0287e533 authored by catch's avatar catch

Issue #2864922 by vaplas, dawehner, Lendude:...

Issue #2864922 by vaplas, dawehner, Lendude: \Drupal\views\Plugin\views\display\EntityReference::render returns the wrong datatype for empty results
parent 89605308
......@@ -90,13 +90,16 @@ public function execute() {
}
/**
* {@inheritdoc}
* Builds the view result as a renderable array.
*
* @return array
* Renderable array or empty array.
*/
public function render() {
if (!empty($this->view->result) && $this->view->style_plugin->evenEmpty()) {
return $this->view->style_plugin->render($this->view->result);
}
return '';
return [];
}
/**
......
......@@ -249,6 +249,12 @@ public function testEntityReferenceDisplay() {
$this->executeView($view);
$this->assertEqual(count($view->result), 2, 'Search returned two rows');
// Test that the render() return empty array for empty result.
$view = Views::getView('test_display_entity_reference');
$view->setDisplay('entity_reference_1');
$render = $view->display_handler->render();
$this->assertSame([], $render, 'Render returned empty array');
}
}
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