diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/area/ListingEmpty.php b/core/modules/node/lib/Drupal/node/Plugin/views/area/ListingEmpty.php index 3334be8..110ae93 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/area/ListingEmpty.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/area/ListingEmpty.php @@ -39,6 +39,7 @@ public function render($empty = FALSE) { ); return $element; } + return array(); } } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/area/Broken.php b/core/modules/views/lib/Drupal/views/Plugin/views/area/Broken.php index c9d70c0..39fc9d0 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/area/Broken.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/area/Broken.php @@ -31,7 +31,7 @@ public function query($group_by = FALSE) { /* No query to run */ } * Implements \Drupal\views\Plugin\views\area\AreaPluginBase::render(). */ public function render($empty = FALSE) { - // Simply render nothing by returning an empty array. + // Simply render nothing by returning an empty render array. return array(); } public function buildOptionsForm(&$form, &$form_state) { diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/area/Entity.php b/core/modules/views/lib/Drupal/views/Plugin/views/area/Entity.php index db5a40c..200cecb 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/area/Entity.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/area/Entity.php @@ -103,13 +103,11 @@ function render($empty = FALSE) { } $entity_id = $this->globalTokenReplace($entity_id); if ($entity = entity_load($this->entityType, $entity_id)) { - $build = entity_view($entity, $this->options['view_mode']); - // @todo Support to just return a render array. - return drupal_render($build); + return entity_view($entity, $this->options['view_mode']); } } - return ''; + return array(); } } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/area/Result.php b/core/modules/views/lib/Drupal/views/Plugin/views/area/Result.php index 99e3462..67bd9c7 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/area/Result.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/area/Result.php @@ -62,7 +62,7 @@ public function buildOptionsForm(&$form, &$form_state) { function render($empty = FALSE) { // Must have options and does not work on summaries. if (!isset($this->options['content']) || $this->view->plugin_name == 'default_summary') { - return; + return array(); } $output = ''; $format = $this->options['content']; diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/area/Title.php b/core/modules/views/lib/Drupal/views/Plugin/views/area/Title.php index 67c9603..61cb8e0 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/area/Title.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/area/Title.php @@ -62,7 +62,8 @@ public function preRender(array $results) { * Implements \Drupal\views\Plugin\views\area\AreaPluginBase::render(). */ public function render($empty = FALSE) { - // Do nothing for this handler. + // Do nothing for this handler by returning an empty render array. + return array(); } } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/area/View.php b/core/modules/views/lib/Drupal/views/Plugin/views/area/View.php index 32653dc..f4eba6a 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/area/View.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/area/View.php @@ -64,7 +64,7 @@ function render($empty = FALSE) { $view = views_get_view($view_name); if (empty($view) || !$view->access($display_id)) { - return; + return array(); } $view->setDisplay($display_id); diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php index 525f327..8205798 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php @@ -58,16 +58,16 @@ public function testAreaText() { $this->executeView($view); $view->display_handler->handlers['header']['area']->options['format'] = $this->randomString(); - $this->assertEqual(NULL, $view->display_handler->handlers['header']['area']->render(), 'Non existant format should return nothing'); + $this->assertEqual(array('#markup' => ''), $view->display_handler->handlers['header']['area']->render(), 'Non existant format should return empty markup.'); $view->display_handler->handlers['header']['area']->options['format'] = filter_default_format(); - $this->assertEqual(check_markup($string), $view->display_handler->handlers['header']['area']->render(), 'Existant format should return something'); + $this->assertEqual(array('#markup' => check_markup($string)), $view->display_handler->handlers['header']['area']->render(), 'Existant format should return something'); // Empty results, and it shouldn't be displayed . - $this->assertEqual('', $view->display_handler->handlers['header']['area']->render(TRUE), 'No result should lead to no header'); + $this->assertEqual(array(), $view->display_handler->handlers['header']['area']->render(TRUE), 'No result should lead to no header'); // Empty results, and it should be displayed. $view->display_handler->handlers['header']['area']->options['empty'] = TRUE; - $this->assertEqual(check_markup($string), $view->display_handler->handlers['header']['area']->render(TRUE), 'No result, but empty enabled lead to a full header'); + $this->assertEqual(array('#markup' => check_markup($string)), $view->display_handler->handlers['header']['area']->render(TRUE), 'No result, but empty enabled lead to a full header'); } } diff --git a/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/area/TestExample.php b/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/area/TestExample.php index 3e43bc8..38ec004 100644 --- a/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/area/TestExample.php +++ b/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/area/TestExample.php @@ -48,6 +48,7 @@ public function render($empty = FALSE) { '#markup' => $this->globalTokenReplace($this->options['string']), ); } + return array(); } }