From 8a245760cdd6ba3f665c14beeec7ad617330aa9b Mon Sep 17 00:00:00 2001 From: Chris Ruppel Date: Tue, 19 Sep 2023 09:40:06 +0200 Subject: [PATCH] fix: Heading paras only output link on main content area of LP Refs: RWR-367 --- .../common_design_subtheme.theme | 11 ++++++++--- ...landing-page--field-paragraphs--heading.html.twig} | 0 2 files changed, 8 insertions(+), 3 deletions(-) rename html/themes/custom/common_design_subtheme/templates/{paragraph--landing-page--heading.html.twig => paragraph--landing-page--field-paragraphs--heading.html.twig} (100%) diff --git a/html/themes/custom/common_design_subtheme/common_design_subtheme.theme b/html/themes/custom/common_design_subtheme/common_design_subtheme.theme index 250e2bbf..37dfe3b9 100644 --- a/html/themes/custom/common_design_subtheme/common_design_subtheme.theme +++ b/html/themes/custom/common_design_subtheme/common_design_subtheme.theme @@ -63,8 +63,13 @@ function common_design_subtheme_theme_suggestions_fullcalendar_alter(array &$sug */ function common_design_subtheme_theme_suggestions_paragraph_alter(&$suggestions, $variables) { $paragraph = $variables['elements']['#paragraph']; - $parent = $paragraph->getParentEntity(); - if ($parent) { - $suggestions[] = 'paragraph__' . $parent->bundle() . '__' . $paragraph->bundle(); + $parent_entity = $paragraph->getParentEntity(); + $parent_field_name = $paragraph->parent_field_name->value; + + if ($parent_entity) { + $suggestions[] = 'paragraph__' . $parent_entity->bundle() . '__' . $paragraph->bundle(); + } + if ($parent_entity && $parent_field_name) { + $suggestions[] = 'paragraph__' . $parent_entity->bundle() . '__' . $parent_field_name . '__' . $paragraph->bundle(); } } diff --git a/html/themes/custom/common_design_subtheme/templates/paragraph--landing-page--heading.html.twig b/html/themes/custom/common_design_subtheme/templates/paragraph--landing-page--field-paragraphs--heading.html.twig similarity index 100% rename from html/themes/custom/common_design_subtheme/templates/paragraph--landing-page--heading.html.twig rename to html/themes/custom/common_design_subtheme/templates/paragraph--landing-page--field-paragraphs--heading.html.twig