diff --git a/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php b/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php index 1182690..bfaf2d0 100644 --- a/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php +++ b/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php @@ -54,11 +54,12 @@ public function execute() { // Prior to this being called, the $view should already be set to this // display, and arguments should be set on the view. $element = $this->view->render(); - if ((!$this->getOption('block_hide_empty') && !$this->outputIsEmpty()) || !empty($this->view->style_plugin->definition['even empty'])) { + if ($this->outputIsEmpty() && $this->getOption('block_hide_empty') && empty($this->view->style_plugin->definition['even empty'])) { + return array(); + } + else { return $element; } - - return array(); } /** @@ -98,7 +99,7 @@ public function optionsSummary(&$categories, &$options) { $options['block_hide_empty'] = array( 'category' => 'other', 'title' => t('Hide block if the view output is empty'), - 'value' => !$this->getOption('block_hide_empty') ? t('Hide') : t('Show'), + 'value' => $this->getOption('block_hide_empty') ? t('Hide') : t('Show'), ); } @@ -159,6 +160,7 @@ public function buildOptionsForm(&$form, &$form_state) { $form['block_hide_empty'] = array( '#title' => t('Hide block if no result/empty text'), + '#type' => 'checkbox', '#description' => t('Hide the block if there is no result and no empty text and no header/footer which is shown on empty result'), '#default_value' => $this->getOption('block_hide_empty'), );