Issue #1807624 by damiankloip, dawehner: Fixed saving and rendering in empty region for 'Global: unfiltered' text.
parent
493004d425
commit
3be8115033
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue