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 6166cb56a397736c41c8c6d81a69816e8faa487e..06f860ac71098fb32a916692688dc129d917bca1 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
@@ -49,6 +49,7 @@ protected function defineOptions() {
     $options['block_description'] = array('default' => '', 'translatable' => TRUE);
     $options['block_category'] = array('default' => 'Views', 'translatable' => TRUE);
     $options['block_caching'] = array('default' => DRUPAL_NO_CACHE);
+    $options['block_hide_empty'] = array('default' => FALSE);
 
     $options['allow'] = array(
       'contains' => array(
@@ -83,11 +84,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 (!empty($this->view->result) || $this->getOption('empty') || !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();
   }
 
   /**
@@ -137,6 +139,12 @@ public function optionsSummary(&$categories, &$options) {
       'title' => t('Block caching'),
       'value' => $types[$this->getCacheType()],
     );
+
+    $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'),
+    );
   }
 
   /**
@@ -200,6 +208,16 @@ public function buildOptionsForm(&$form, &$form_state) {
           '#default_value' => $this->getCacheType(),
         );
         break;
+      case 'block_hide_empty':
+        $form['#title'] .= t('Block empty settings');
+
+        $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'),
+        );
+        break;
       case 'exposed_form_options':
         $this->view->initHandlers();
         if (!$this->usesExposed() && parent::usesExposed()) {
@@ -237,6 +255,7 @@ public function submitOptionsForm(&$form, &$form_state) {
       case 'block_category':
       case 'block_caching':
       case 'allow':
+      case 'block_hide_empty':
         $this->setOption($form_state['section'], $form_state['values'][$form_state['section']]);
         break;
     }
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php
index 056aeef63df3cfe857304aa2e985db2458589b44..b3028613b9265fef32b2475532d45f3b5bab8228 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php
@@ -106,6 +106,19 @@ public function preRender(array $results) {
    */
   public abstract function render($empty = FALSE);
 
+  /**
+   * Does that area have nothing to show.
+   *
+   * This method should be overridden by more complex handlers where the output
+   * is not static and maybe itself be empty if it's rendered.
+   *
+   * @return bool
+   *   Return TRUE if the area is empty, else FALSE.
+   */
+  public function isEmpty() {
+    return empty($this->options['empty']);
+  }
+
   /**
    * Area handlers shouldn't have groupby.
    */
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/area/View.php b/core/modules/views/lib/Drupal/views/Plugin/views/area/View.php
index 103df0ab6a609f9e01b4edacce349a80995c10f0..8b7f21cd6463522c8d2f9677524fc39a8b34ceb2 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/area/View.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/area/View.php
@@ -18,6 +18,16 @@
  */
 class View extends AreaPluginBase {
 
+  /**
+   * Stores whether the embedded view is actually empty.
+   *
+   * @var bool
+   */
+  protected $isEmpty;
+
+  /**
+   * {@inheritdoc}
+   */
   protected function defineOptions() {
     $options = parent::defineOptions();
 
@@ -77,14 +87,28 @@ public function render($empty = FALSE) {
       }
       else {
         if (!empty($this->options['inherit_arguments']) && !empty($this->view->args)) {
-          return $view->preview($display_id, $this->view->args);
+          $output = $view->preview($display_id, $this->view->args);
         }
         else {
-          return $view->preview($display_id);
+          $output = $view->preview($display_id);
         }
+        $this->isEmpty = $view->display_handler->outputIsEmpty();
+        return $output;
       }
     }
     return array();
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function isEmpty() {
+    if (isset($this->isEmpty)) {
+      return $this->isEmpty;
+    }
+    else {
+      return parent::isEmpty();
+    }
+  }
+
 }
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
index 5cae91322f3ee4dc4a9751602d3bb4ad49a31752..498fccdb3f18a0def273c62006a31e889aa8997c 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
@@ -2723,6 +2723,34 @@ public function isIdentifierUnique($id, $identifier) {
     return TRUE;
   }
 
+ /**
+  * 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 bool
+  *   Returns TRUE if the output is empty, else FALSE.
+  */
+ 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;
+ }
+
   /**
    * Provide the block system with any exposed widget blocks for this display.
    */
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayTest.php
index 5fb2973d4a382d39d0566d880d30b670c23a59c5..884271880040cd5126a413d5688f12a7c208505a 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\views\Tests\Plugin;
 
+use Drupal\views\Views;
 use Drupal\views_test_data\Plugin\views\display\DisplayTest as DisplayTestPlugin;
 
 /**
@@ -19,7 +20,7 @@ class DisplayTest extends PluginTestBase {
    *
    * @var array
    */
-  public static $testViews = array('test_filter_groups', 'test_get_attach_displays', 'test_view', 'test_display_more', 'test_display_invalid');
+  public static $testViews = array('test_filter_groups', 'test_get_attach_displays', 'test_view', 'test_display_more', 'test_display_invalid', 'test_display_empty');
 
   /**
    * Modules to enable.
@@ -273,4 +274,47 @@ public function testInvalidDisplayPlugins() {
     $this->assertNoBlockAppears($block);
   }
 
+  /**
+   * Tests the outputIsEmpty method on the display.
+   */
+  public function testOutputIsEmpty() {
+    $view = Views::getView('test_display_empty');
+    $this->executeView($view);
+    $this->assertTrue(count($view->result) > 0, 'Ensure the result of the view is not empty.');
+    $this->assertFalse($view->display_handler->outputIsEmpty(), 'Ensure the view output is marked as not empty.');
+    $view->destroy();
+
+    // Add a filter, so the view result is empty.
+    $view->setDisplay('default');
+    $item = array(
+      'table' => 'views_test_data',
+      'field' => 'id',
+      'id' => 'id',
+      'value' => array('value' => 7297)
+    );
+    $view->setItem('default', 'filter', 'id', $item);
+    $this->executeView($view);
+    $this->assertFalse(count($view->result), 'Ensure the result of the view is empty.');
+    $this->assertFalse($view->display_handler->outputIsEmpty(), 'Ensure the view output is marked as not empty, because the empty text still appears.');
+    $view->destroy();
+
+    // Remove the empty area, but mark the header area to still appear.
+    $view->removeItem('default', 'empty', 'area');
+    $item = $view->getItem('default', 'header', 'area');
+    $item['empty'] = TRUE;
+    $view->setItem('default', 'header', 'area', $item);
+    $this->executeView($view);
+    $this->assertFalse(count($view->result), 'Ensure the result of the view is empty.');
+    $this->assertFalse($view->display_handler->outputIsEmpty(), 'Ensure the view output is marked as not empty, because the header text still appears.');
+    $view->destroy();
+
+    // Hide the header on empty results.
+    $item = $view->getItem('default', 'header', 'area');
+    $item['empty'] = FALSE;
+    $view->setItem('default', 'header', 'area', $item);
+    $this->executeView($view);
+    $this->assertFalse(count($view->result), 'Ensure the result of the view is empty.');
+    $this->assertTrue($view->display_handler->outputIsEmpty(), 'Ensure the view output is marked as empty.');
+  }
+
 }
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_empty.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_empty.yml
new file mode 100644
index 0000000000000000000000000000000000000000..eda6f8414fa3c1ba93e6e35aebe5c97d54e94e7a
--- /dev/null
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_empty.yml
@@ -0,0 +1,44 @@
+base_table: views_test_data
+core: '8'
+description: ''
+status: '1'
+display:
+  default:
+    display_options:
+      defaults:
+        fields: '0'
+        pager: '0'
+        pager_options: '0'
+        sorts: '0'
+      fields:
+        id:
+          field: id
+          id: id
+          relationship: none
+          table: views_test_data
+          plugin_id: numeric
+      pager:
+        options:
+          offset: '0'
+        type: none
+      pager_options: {  }
+      header:
+        area:
+          field: area
+          id: area
+          table: views
+          plugin_id: text
+      empty:
+        area:
+          field: area
+          id: area
+          table: views
+          plugin_id: text
+    display_plugin: default
+    display_title: Master
+    id: default
+    position: '0'
+label: ''
+langcode: en
+id: test_display_empty
+tag: ''