Skip to content
Snippets Groups Projects
Commit c66a78c6 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2021829 by damiankloip, olli: Fixed Redundant executeView() in ViewsBlock::build().

parent c6ebde43
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -54,8 +54,10 @@ public function execute() {
// display, and arguments should be set on the view.
$element = $this->view->render();
if (!empty($this->view->result) || $this->getOption('empty') || !empty($this->view->style_plugin->definition['even empty'])) {
return drupal_render($element);
return $element;
}
return array();
}
/**
......
......@@ -11,6 +11,7 @@
use Drupal\Component\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;
use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\Component\Utility\Xss;
/**
* Provides a generic Views block.
......@@ -74,14 +75,11 @@ public function form($form, &$form_state) {
*/
public function build() {
if ($output = $this->view->executeDisplay($this->displayID)) {
$output = $this->view->executeDisplay($this->displayID);
// Set the label to the title configured in the view.
$this->configuration['label'] = filter_xss_admin($this->view->getTitle());
$this->configuration['label'] = Xss::filterAdmin($this->view->getTitle());
// Before returning the block output, convert it to a renderable array
// with contextual links.
$this->addContextualLinks($output);
$this->view->destroy();
return $output;
}
......
......@@ -1333,7 +1333,7 @@ public function render($display_id = NULL) {
public function executeDisplay($display_id = NULL, $args = array()) {
if (empty($this->current_display) || $this->current_display != $this->chooseDisplay($display_id)) {
if (!$this->setDisplay($display_id)) {
return FALSE;
return NULL;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment