Skip to content
Snippets Groups Projects
Commit fb696fea authored by Brooke Heaton's avatar Brooke Heaton Committed by Shelane French
Browse files

Issue #2909326 by brooke_heaton: Empty Views Tabs still being rendered

parent 42fc5fdb
No related branches found
No related tags found
No related merge requests found
......@@ -103,7 +103,33 @@ class ViewContent extends TabTypeBase {
return [];
}
// Return empty if the view is empty.
$view_results = views_get_view_result($options['vid'], $options['display']);
if (!$view_results && !empty($options['vid']) && !empty($options['display'])) {
// if the initial view is empty, check the attachments
$view = Views::getView($options['vid']);
$view->setDisplay($options['display']);
$display = $view->getDisplay();
$attachments = $display->getAttachedDisplays();
// If there are attachments, check if they are empty.
if (!empty($attachments)) {
foreach ($attachments as $attachment) {
if (!empty(views_get_view_result($options['vid'], $attachment))) {
$view_results = TRUE;
continue;
}
}
}
}
if (empty($view_results)) {
return [];
}
else {
$render = $view->buildRenderable($options['display'], $args);
}
// Set additional cache keys that depend on the arguments provided for this
// view.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment