diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index 3e3ff11..f235b04 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -352,8 +352,12 @@ public function preSave(EntityStorageInterface $storage) { * {@inheritdoc} */ public function calculateDependencies() { - // All dependencies should be recalculated on every save apart from enforced - // dependencies. This ensures stale dependencies are never saved. + // Content dependencies are preserved because they are soft and the content + // might not exist when the configuration entity is created. This can be the + // case during configuration sync. Enforced dependencies are preserved + // because this is the only place this information exists. Recalculating + // configuration and module dependencies ensures stale information is never + // saved. $this->dependencies = array_intersect_key($this->dependencies, ['enforced' => '', 'content' => '']); if ($this instanceof EntityWithPluginCollectionInterface) { // Configuration entities need to depend on the providers of any plugins diff --git a/core/modules/block_content/tests/src/Kernel/BlockContentDependencyTest.php b/core/modules/block_content/tests/src/Kernel/BlockContentDependencyTest.php index 7a6921e..eb370ea 100644 --- a/core/modules/block_content/tests/src/Kernel/BlockContentDependencyTest.php +++ b/core/modules/block_content/tests/src/Kernel/BlockContentDependencyTest.php @@ -15,6 +15,8 @@ use Drupal\KernelTests\KernelTestBase; /** + * Tests block content configuration dependencies. + * * @group block_content */ class BlockContentDependencyTest extends KernelTestBase {