Skip to content

Commit

Permalink
Merge pull request #890 from City-of-Helsinki/UHF-11222
Browse files Browse the repository at this point in the history
UHF-11222: Language support for the curated event list, fix translation in the content listing view
  • Loading branch information
teroelonen authored Jan 24, 2025
2 parents 068c941 + 7084c63 commit ce23005
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
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

0 comments on commit ce23005

Please sign in to comment.