diff --git a/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php b/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php
index db0383e..073f7d8 100644
--- a/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php
+++ b/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php
@@ -34,7 +34,8 @@ abstract class AreaPluginBase extends HandlerBase {
   public function init(ViewExecutable $view, &$options) {
     $this->setOptionDefaults($this->options, $this->defineOptions());
     parent::init($view, $options);
-    if ($this->definition['plugin_type'] == 'empty') {
+
+    if (isset($this->handler_type) && ($this->handler_type == 'empty')) {
       $this->options['empty'] = TRUE;
     }
   }
diff --git a/lib/Drupal/views/Plugin/views/area/TextCustom.php b/lib/Drupal/views/Plugin/views/area/TextCustom.php
index f0d410c..9e7c172 100644
--- a/lib/Drupal/views/Plugin/views/area/TextCustom.php
+++ b/lib/Drupal/views/Plugin/views/area/TextCustom.php
@@ -18,7 +18,7 @@ use Drupal\Core\Annotation\Plugin;
  *   id = "text_custom"
  * )
  */
-class TextCustom extends AreaPluginBase {
+class TextCustom extends Text {
 
   protected function defineOptions() {
     $options = parent::defineOptions();
diff --git a/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
index e8b2327..e17636b 100644
--- a/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
+++ b/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
@@ -2442,7 +2442,7 @@ abstract class DisplayPluginBase extends PluginBase {
    * Render the header of the view.
    */
   public function renderHeader() {
-    $empty = !empty($this->view->result);
+    $empty = empty($this->view->result);
     return $this->renderArea('header', $empty);
   }
 
@@ -2450,12 +2450,12 @@ abstract class DisplayPluginBase extends PluginBase {
    * Render the footer of the view.
    */
   public function renderFooter() {
-    $empty = !empty($this->view->result);
+    $empty = empty($this->view->result);
     return $this->renderArea('footer', $empty);
   }
 
   public function renderEmpty() {
-    return $this->renderArea('empty');
+    return $this->renderArea('empty', TRUE);
   }
 
   /**
diff --git a/lib/Drupal/views/Tests/Handler/AreaTest.php b/lib/Drupal/views/Tests/Handler/AreaTest.php
index 7249562..b138fce 100644
--- a/lib/Drupal/views/Tests/Handler/AreaTest.php
+++ b/lib/Drupal/views/Tests/Handler/AreaTest.php
@@ -93,8 +93,13 @@ class AreaTest extends HandlerTestBase {
     $header_string = $this->randomString();
     $footer_string = $this->randomString();
     $empty_string = $this->randomString();
+
     $view->header['test_example']->options['string'] = $header_string;
+    $view->header['test_example']->options['empty'] = TRUE;
+
     $view->footer['test_example']->options['string'] = $footer_string;
+    $view->footer['test_example']->options['empty'] = TRUE;
+
     $view->empty['test_example']->options['string'] = $empty_string;
 
     // Check whether the strings exists in the output.
diff --git a/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/area/TestExample.php b/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/area/TestExample.php
index 713c84f..78efe64 100644
--- a/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/area/TestExample.php
+++ b/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/area/TestExample.php
@@ -35,7 +35,9 @@ class TestExample extends AreaPluginBase {
    * Overrides Drupal\views\Plugin\views\area\AreaPluginBase::render().
    */
   public function render($empty = FALSE) {
-    return $this->options['string'];
+    if (!$empty || !empty($this->options['empty'])) {
+      return $this->options['string'];
+    }
   }
 
 }
