Snippets

Oleksiy Kalinichenko Custom fix for "Default text formats" based on https://www.drupal.org/node/1278886 for Drupal 8.6 and 8.7

Created by Oleksiy Kalinichenko
diff --git a/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php b/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php
index e70fadacb1..1de5597a98 100644
--- a/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php
+++ b/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php
@@ -49,7 +49,9 @@ public function applyDefaultValue($notify = TRUE) {
    */
   public function isEmpty() {
     $value = $this->get('value')->getValue();
-    return $value === NULL || $value === '';
+    $format = $this->get('format')->getValue();
+
+    return ($value === NULL || $value === '') && ($format === NULL || $format === '');
   }
 
   /**

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.