diff --git a/composer.json b/composer.json index f429aed09a4ad13a1a5f957d69f15a4427453dde..cfdd28581dac798aed86b4568773da19ac4e4088 100644 --- a/composer.json +++ b/composer.json @@ -90,6 +90,9 @@ "patches": { "drupal/entity_reference_revisions": { "https://www.drupal.org/project/entity_reference_revisions/issues/2937835": "https://www.drupal.org/files/issues/2021-03-26/entity_reference_revisions-field_formatter_label-2937835-36.patch" + }, + "openeuropa/oe_bootstrap_theme": { + "latest": "https://github.com/openeuropa/oe_bootstrap_theme/compare/0.1.202206071025..1.x.diff" } }, "drupal-scaffold": { diff --git a/templates/content/node--oe-sc-event--full.html.twig b/templates/content/node--oe-sc-event--full.html.twig index f776617687811f1833abbfdeaefb91cac6bdfe51..76eebb32b298f9c24dbdb213a437cd534e7fbf95 100755 --- a/templates/content/node--oe-sc-event--full.html.twig +++ b/templates/content/node--oe-sc-event--full.html.twig @@ -45,10 +45,14 @@ {% endset %} <article{{attributes}}> - {{ pattern('inpage_navigation', { - title: 'Page content', - links: inpage_navigation_links, - content: inpage_navigation_fields, - full_layout: true, - }) }} + {% if inpage_navigation_links is empty %} + {{ inpage_navigation_fields }} + {% else %} + {{ pattern('inpage_navigation', { + title: 'Page content', + links: inpage_navigation_links, + content: inpage_navigation_fields, + full_layout: true, + }) }} + {% endif %} </article> diff --git a/tests/src/Functional/ContentEventRenderTest.php b/tests/src/Functional/ContentEventRenderTest.php index 9163263d20ff8dc3c578e0edcb59f0d21c75e468..7f7d10b299d892400f3bd6e6546ce9a5661437e7 100644 --- a/tests/src/Functional/ContentEventRenderTest.php +++ b/tests/src/Functional/ContentEventRenderTest.php @@ -153,6 +153,15 @@ class ContentEventRenderTest extends WhitelabelBrowserTestBase { 'Event body', $crawler->filter('#oe-content-body p')->text() ); + + // Assert inpage_navigation not loaded if there is no body and documents. + $node->set('oe_documents', NULL); + $node->set('body', NULL); + $node->save(); + + $this->drupalGet('node/' . $node->id()); + + $this->assertSession()->elementNotExists('css', 'nav.bcl-inpage-navigation'); } /**