diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php index 70ba409..a1d357a 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php @@ -73,15 +73,6 @@ public $relationship = NULL; /** - * The type of this handler. - * - * The type of a handler is one of ViewExecutable::viewsHandlerTypes(). - * - * @var string - */ - public $handler_type; - - /** * Constructs a Handler object. */ public function __construct(array $configuration, $plugin_id, array $plugin_definition) { diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php index 62ac0c8..40abd08 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php @@ -27,6 +27,13 @@ abstract class AreaPluginBase extends HandlerBase { /** + * The type of this area handler, i.e. 'header', 'footer', or 'empty'. + * + * @var string + */ + public $handlerType; + + /** * Overrides Drupal\views\Plugin\views\HandlerBase::init(). * * Make sure that no result area handlers are set to be shown when the result @@ -35,7 +42,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - if (isset($this->handler_type) && ($this->handler_type == 'empty')) { + if ($this->handlerType == 'empty') { $this->options['empty'] = TRUE; } } 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 ef855e2..321f6f2 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 @@ -52,18 +52,12 @@ public function buildOptionsForm(&$form, &$form_state) { public function preRender(array $results) { parent::preRender($results); - if (!empty($this->options['title'])) { - // Don't run the preRender function if this handler is part of the empty - // result set, and the result is not empty. - if (!empty($results) && $this->handler_type == 'empty') { - return; - } - + // If a title is provided, process it. If the area is for the empty + // result set, ensure there are no results. + if (!empty($this->options['title']) && ($this->handlerType != 'empty' || empty($results))) { $value = $this->globalTokenReplace($this->options['title']); $this->view->setTitle($this->sanitizeValue($value, 'xss_admin'), PASS_THROUGH); } - - return ''; } /** diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php index a252414..33746a7 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -879,7 +879,7 @@ public function getHandlers($type) { if ($handler) { // Special override for area types so they know where they come from. if ($handler_type == 'area') { - $handler->handler_type = $type; + $handler->handlerType = $type; } $handler->init($this->view, $this, $info); diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTitleTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTitleTest.php index ea58a3b..d0d06cf 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTitleTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTitleTest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\views\Tests\Handler\AreaTitleTest. + * Contains \Drupal\views\Tests\Handler\AreaTitleTest. */ namespace Drupal\views\Tests\Handler; @@ -31,10 +31,6 @@ public static function getInfo() { ); } - protected function setUp() { - parent::setUp(); - } - /** * Tests the title area handler. */