diff --git a/core/modules/block_content/block_content.install b/core/modules/block_content/block_content.install index e8ee49260e..c59f3fd258 100644 --- a/core/modules/block_content/block_content.install +++ b/core/modules/block_content/block_content.install @@ -149,8 +149,8 @@ function block_content_update_8600() { ->setDescription(t('The parent entity type.')) ->setTranslatable(FALSE) ->setRevisionable(FALSE) - ->setDefaultValue('') - ->setInitialValue(''); + ->setDefaultValue(NULL) + ->setInitialValue(NULL); $update_manager->installFieldStorageDefinition('parent_entity_type', 'block_content', 'block_content', $parent_entity_type); @@ -159,8 +159,8 @@ function block_content_update_8600() { ->setDescription(t('The parent entity ID.')) ->setTranslatable(FALSE) ->setRevisionable(FALSE) - ->setDefaultValue('') - ->setInitialValue(''); + ->setDefaultValue(NULL) + ->setInitialValue(NULL); $update_manager->installFieldStorageDefinition('parent_entity_id', 'block_content', 'block_content', $parent_entity_id); } diff --git a/core/modules/block_content/src/Entity/BlockContent.php b/core/modules/block_content/src/Entity/BlockContent.php index ba5002f634..2a83477036 100644 --- a/core/modules/block_content/src/Entity/BlockContent.php +++ b/core/modules/block_content/src/Entity/BlockContent.php @@ -354,4 +354,5 @@ public function hasParentEntity() { // a parent. return !empty($this->get('parent_entity_type')->value) || !empty($this->get('parent_entity_id')->value); } + } diff --git a/core/modules/block_content/tests/src/Functional/Update/BlockContentParentEntityUpdateTest.php b/core/modules/block_content/tests/src/Functional/Update/BlockContentParentEntityUpdateTest.php index bd7cf0d771..943dee34b7 100644 --- a/core/modules/block_content/tests/src/Functional/Update/BlockContentParentEntityUpdateTest.php +++ b/core/modules/block_content/tests/src/Functional/Update/BlockContentParentEntityUpdateTest.php @@ -96,11 +96,8 @@ public function testParentFieldsAddition() { $this->assertEquals(TRUE, $block_with_parent->hasParentEntity()); $this->assertEquals(TRUE, $block2_with_parent->hasParentEntity()); - - // Ensure the Custom Block view shows the blocks without parents only. $this->drupalGet('admin/structure/block/block-content'); - file_put_contents('/Users/ted.bowman/Sites/www/test.html', $this->getSession()->getPage()->getOuterHtml()); $assert_session->statusCodeEquals('200'); $assert_session->responseContains('view-id-block_content'); $assert_session->pageTextContains($after_block1->label()); @@ -162,7 +159,6 @@ public function testParentFieldsAddition() { $this->drupalGet('block/' . $block_with_parent->id()); $assert_session->statusCodeEquals('403'); - } }