diff --git a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php index 85f39c2acc..3eeb69184a 100644 --- a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php +++ b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php @@ -45,9 +45,9 @@ class LayoutBuilderEntityViewDisplay extends BaseEntityViewDisplay implements La * Each counter takes into account all the relevant information about the * field and the referenced entity that is being rendered. * - * @see \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter::viewElements() - * * @var array + * + * @see \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter::viewElements() */ protected static $recursiveRenderDepth = []; diff --git a/core/modules/layout_builder/tests/src/Functional/LayoutRecursionTest.php b/core/modules/layout_builder/tests/src/Functional/LayoutRecursionTest.php index 159d507a25..173ec8b00e 100644 --- a/core/modules/layout_builder/tests/src/Functional/LayoutRecursionTest.php +++ b/core/modules/layout_builder/tests/src/Functional/LayoutRecursionTest.php @@ -28,11 +28,6 @@ class LayoutRecursionTest extends BrowserTestBase { protected function setUp() { parent::setUp(); - // @todo The Layout Builder UI relies on local tasks; fix in - // https://www.drupal.org/project/drupal/issues/2917777. - $this->drupalPlaceBlock('local_tasks_block'); - - // @todo Find balance. // when creating 5 nodes here // \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::RECURSIVE_RENDER_LIMIT @@ -58,6 +53,6 @@ public function testRecursionPrevention() { $this->drupalGet('node/1'); $this->assertSession()->pageTextContains("Title 1"); - } + } diff --git a/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderCompatibilityTestBase.php b/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderCompatibilityTestBase.php index 72ee01ac60..3f244297ae 100644 --- a/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderCompatibilityTestBase.php +++ b/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderCompatibilityTestBase.php @@ -6,6 +6,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; +use Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay; use Drupal\KernelTests\Core\Entity\EntityKernelTestBase; /** @@ -116,6 +117,13 @@ protected function enableOverrides() { protected function assertFieldAttributes(EntityInterface $entity, array $attributes) { $view_builder = $this->container->get('entity_type.manager')->getViewBuilder($entity->getEntityTypeId()); $build = $view_builder->view($entity); + + if ($this->display instanceof LayoutBuilderEntityViewDisplay) { + $property = new \ReflectionProperty($this->display, 'recursiveRenderDepth'); + $property->setAccessible(TRUE); + $property->setValue($this->recursiveRenderDepth, []); + } + $this->render($build); $actual = array_map(function (\SimpleXMLElement $element) { diff --git a/core/modules/layout_builder/tests/src/Kernel/SectionComponentRecursionTest.php b/core/modules/layout_builder/tests/src/Kernel/SectionComponentRecursionTest.php index c5cc07bcd3..db05c6c9f6 100644 --- a/core/modules/layout_builder/tests/src/Kernel/SectionComponentRecursionTest.php +++ b/core/modules/layout_builder/tests/src/Kernel/SectionComponentRecursionTest.php @@ -8,7 +8,7 @@ use Drupal\layout_builder\SectionComponent; /** - * Tests the recursion protection in \Drupal\layout_builder\SectionComponent.\ + * Tests the recursion protection in \Drupal\layout_builder\SectionComponent. * * @group layout_builder */