From 3b98df3fb2b75e6c762845b963549ba3e8e327ec Mon Sep 17 00:00:00 2001 From: Tero Elonen Date: Mon, 19 Jun 2023 16:11:24 +0300 Subject: [PATCH 1/2] UHF-6102: Enable latest news paragraph for front page instance standard page lower content region --- ...ld.field.node.page.field_lower_content.yml | 5 +++ .../helfi_etusivu/helfi_etusivu.install | 5 +++ .../custom/helfi_etusivu/helfi_etusivu.module | 31 +++++++++++++------ 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/conf/cmi/field.field.node.page.field_lower_content.yml b/conf/cmi/field.field.node.page.field_lower_content.yml index 647acdcd1..8cab35f53 100644 --- a/conf/cmi/field.field.node.page.field_lower_content.yml +++ b/conf/cmi/field.field.node.page.field_lower_content.yml @@ -14,6 +14,7 @@ dependencies: - paragraphs.paragraphs_type.content_liftup - paragraphs.paragraphs_type.event_list - paragraphs.paragraphs_type.from_library + - paragraphs.paragraphs_type.front_page_latest_news - paragraphs.paragraphs_type.image - paragraphs.paragraphs_type.list_of_links - paragraphs.paragraphs_type.map @@ -53,6 +54,7 @@ settings: phasing: phasing remote_video: remote_video map: map + front_page_latest_news: front_page_latest_news negate: 0 target_bundles_drag_drop: accordion: @@ -82,6 +84,9 @@ settings: from_library: weight: 0 enabled: true + front_page_latest_news: + weight: 0 + enabled: true image: weight: 0 enabled: true diff --git a/public/modules/custom/helfi_etusivu/helfi_etusivu.install b/public/modules/custom/helfi_etusivu/helfi_etusivu.install index ef38b9a98..e22f3f1f8 100644 --- a/public/modules/custom/helfi_etusivu/helfi_etusivu.install +++ b/public/modules/custom/helfi_etusivu/helfi_etusivu.install @@ -209,3 +209,8 @@ function helfi_etusivu_update_9007() : void { ->save(); } } + + +function helfi_etusivu_update_9008(): void { + helfi_platform_config_update_paragraph_target_types(); +} diff --git a/public/modules/custom/helfi_etusivu/helfi_etusivu.module b/public/modules/custom/helfi_etusivu/helfi_etusivu.module index 6850d14a6..29d95b30e 100644 --- a/public/modules/custom/helfi_etusivu/helfi_etusivu.module +++ b/public/modules/custom/helfi_etusivu/helfi_etusivu.module @@ -129,19 +129,32 @@ function helfi_etusivu_cron() : void { * Implements hook_helfi_paragraph_types(). */ function helfi_etusivu_helfi_paragraph_types() : array { - $types = [ - 'field_content' => [ - 'front_page_latest_news', - 'front_page_top_news', - 'current', - 'event_list', + $entities = [ + 'node' => [ + 'landing_page' => [ + 'field_content' => [ + 'front_page_latest_news', + 'front_page_top_news', + 'current', + 'event_list', + ], + ], + 'page' => [ + 'field_lower_content' => [ + 'front_page_latest_news', + ], + ], ], ]; $enabled = []; - foreach ($types as $field => $paragraphTypes) { - foreach ($paragraphTypes as $paragraphType) { - $enabled[] = new ParagraphTypeCollection('node', 'landing_page', $field, $paragraphType); + foreach ($entities as $entityTypeId => $bundles) { + foreach ($bundles as $bundle => $fields) { + foreach ($fields as $field => $paragraphTypes) { + foreach ($paragraphTypes as $paragraphType) { + $enabled[] = new ParagraphTypeCollection($entityTypeId, $bundle, $field, $paragraphType); + } + } } } return $enabled; From 732ff1106f205563f5a6ead9026f91fbec158637 Mon Sep 17 00:00:00 2001 From: Tero Elonen Date: Mon, 19 Jun 2023 16:28:25 +0300 Subject: [PATCH 2/2] UHF-6102: Fixed PHPCS issues --- public/modules/custom/helfi_etusivu/helfi_etusivu.install | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/modules/custom/helfi_etusivu/helfi_etusivu.install b/public/modules/custom/helfi_etusivu/helfi_etusivu.install index e22f3f1f8..f566ce964 100644 --- a/public/modules/custom/helfi_etusivu/helfi_etusivu.install +++ b/public/modules/custom/helfi_etusivu/helfi_etusivu.install @@ -210,7 +210,9 @@ function helfi_etusivu_update_9007() : void { } } - +/** + * UHF-6102: Add latest news paragraph to lower content area on basic page. + */ function helfi_etusivu_update_9008(): void { helfi_platform_config_update_paragraph_target_types(); }