Skip to content

Commit

Permalink
Merge pull request #394 from City-of-Helsinki/UHF-6102_latest_news_fo…
Browse files Browse the repository at this point in the history
…r_standard_page

UHF-6102: Enable latest news paragraph for front page instance standard page lower content region
  • Loading branch information
teroelonen authored Jun 20, 2023
2 parents 108cfbf + 732ff11 commit 4cf3088
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
5 changes: 5 additions & 0 deletions conf/cmi/field.field.node.page.field_lower_content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -82,6 +84,9 @@ settings:
from_library:
weight: 0
enabled: true
front_page_latest_news:
weight: 0
enabled: true
image:
weight: 0
enabled: true
Expand Down
7 changes: 7 additions & 0 deletions public/modules/custom/helfi_etusivu/helfi_etusivu.install
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,10 @@ function helfi_etusivu_update_9007() : void {
->save();
}
}

/**
* 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();
}
31 changes: 22 additions & 9 deletions public/modules/custom/helfi_etusivu/helfi_etusivu.module
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4cf3088

Please sign in to comment.