You are here

public function DisplayPluginBase::outputIsEmpty in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::outputIsEmpty()

Is the output of the view empty.

If a view has no result and neither the empty, nor the footer nor the header does show anything return FALSE.

Return value

bool Returns TRUE if the output is empty, else FALSE.

Overrides DisplayPluginInterface::outputIsEmpty

1 call to DisplayPluginBase::outputIsEmpty()
Block::execute in core/modules/views/src/Plugin/views/display/Block.php
The display block handler returns the structure necessary for a block.

File

core/modules/views/src/Plugin/views/display/DisplayPluginBase.php, line 2491
Contains \Drupal\views\Plugin\views\display\DisplayPluginBase.

Class

DisplayPluginBase
Base class for views display plugins.

Namespace

Drupal\views\Plugin\views\display

Code

public function outputIsEmpty() {
  if (!empty($this->view->result)) {
    return FALSE;
  }

  // Check whether all of the area handlers are empty.
  foreach (array(
    'empty',
    'footer',
    'header',
  ) as $type) {
    $handlers = $this
      ->getHandlers($type);
    foreach ($handlers as $handler) {

      // If one is not empty, return FALSE now.
      if (!$handler
        ->isEmpty()) {
        return FALSE;
      }
    }
  }
  return TRUE;
}