Issue #1807624 by damiankloip, dawehner: Fixed saving and rendering in empty region for 'Global: unfiltered' text.

8.0.x
damiankloip 2012-10-10 14:27:11 -04:00 committed by Tim Plunkett
parent 493004d425
commit 3be8115033
5 changed files with 14 additions and 6 deletions

View File

@ -34,7 +34,8 @@ abstract class AreaPluginBase extends HandlerBase {
public function init(ViewExecutable $view, &$options) {
$this->setOptionDefaults($this->options, $this->defineOptions());
parent::init($view, $options);
if ($this->definition['plugin_type'] == 'empty') {
if (isset($this->handler_type) && ($this->handler_type == 'empty')) {
$this->options['empty'] = TRUE;
}
}

View File

@ -18,7 +18,7 @@ use Drupal\Core\Annotation\Plugin;
* id = "text_custom"
* )
*/
class TextCustom extends AreaPluginBase {
class TextCustom extends Text {
protected function defineOptions() {
$options = parent::defineOptions();

View File

@ -2442,7 +2442,7 @@ abstract class DisplayPluginBase extends PluginBase {
* Render the header of the view.
*/
public function renderHeader() {
$empty = !empty($this->view->result);
$empty = empty($this->view->result);
return $this->renderArea('header', $empty);
}
@ -2450,12 +2450,12 @@ abstract class DisplayPluginBase extends PluginBase {
* Render the footer of the view.
*/
public function renderFooter() {
$empty = !empty($this->view->result);
$empty = empty($this->view->result);
return $this->renderArea('footer', $empty);
}
public function renderEmpty() {
return $this->renderArea('empty');
return $this->renderArea('empty', TRUE);
}
/**

View File

@ -93,8 +93,13 @@ class AreaTest extends HandlerTestBase {
$header_string = $this->randomString();
$footer_string = $this->randomString();
$empty_string = $this->randomString();
$view->header['test_example']->options['string'] = $header_string;
$view->header['test_example']->options['empty'] = TRUE;
$view->footer['test_example']->options['string'] = $footer_string;
$view->footer['test_example']->options['empty'] = TRUE;
$view->empty['test_example']->options['string'] = $empty_string;
// Check whether the strings exists in the output.

View File

@ -35,7 +35,9 @@ class TestExample extends AreaPluginBase {
* Overrides Drupal\views\Plugin\views\area\AreaPluginBase::render().
*/
public function render($empty = FALSE) {
return $this->options['string'];
if (!$empty || !empty($this->options['empty'])) {
return $this->options['string'];
}
}
}