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-11222: Language support for the curated event list, fix translation in the content listing view #890

Merged
merged 2 commits into from
Jan 24, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ display:
fields:
langcode:
label: Kieli
separator: ', '
title:
label: Otsikko
type:
Expand Down Expand Up @@ -51,9 +52,9 @@ display:
group_info:
label: Julkaisutila
group_items:
1:
-
title: Julkaistu
2:
-
title: Julkaisematon
langcode:
expose:
Expand Down
9 changes: 9 additions & 0 deletions modules/hdbt_admin_tools/hdbt_admin_tools.install
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,12 @@ function hdbt_admin_tools_update_9005(): void {
$language_switcher_block->save();
}
}

/**
* UHF-11222: Fix issue with publish state translation on content listing view.
*/
function hdbt_admin_tools_update_9006(): void {
// Re-import 'hdbt_admin_tools' configuration.
\Drupal::service('helfi_platform_config.config_update_helper')
->update('hdbt_admin_tools');
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
class Events extends ExternalEntityStorageClientBase {
protected const API_URL = 'https://api.hel.fi/linkedevents/v1';
protected const EVENTS_BASE_URL = 'https://tapahtumat.hel.fi/events/';
protected const EVENTS_BASE_URL = 'https://tapahtumat.hel.fi/';

/**
* The current language service.
Expand Down Expand Up @@ -166,10 +166,18 @@ public function query(
continue;
}

$event_url = '/events/';
if ($langcode === 'fi') {
$event_url = '/tapahtumat/';
}
elseif ($langcode === 'sv') {
$event_url = '/kurser/';
}

$event['clean_title'] = $event['name'][$langcode];
$start = new \DateTime($event['start_time']);
$event['title'] = $event['clean_title'] . ' (' . $start->format('d.m.Y H:i') . ')';
$event['external_link'] = self::EVENTS_BASE_URL . $event['id'];
$event['external_link'] = self::EVENTS_BASE_URL . $langcode . $event_url . $event['id'];
$prepared[$event['id']] = $event;
}

Expand Down
Loading