Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-6102: Enable latest news paragraph for front page instance standard page lower content region #394

Merged
merged 2 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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