Skip to content

Commit

Permalink
TMS-1009: Fix Eventz fatal error for language versions
Browse files Browse the repository at this point in the history
  • Loading branch information
eebbi committed Feb 28, 2024
1 parent c5cd0ec commit 4ad502d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

- TMS-1009: Fix error when fetching Eventz response with languages other than fi & en

## [1.54.5] - 2024-02-01

- TMS-977: Add 'clear form' button to event-search
Expand Down
4 changes: 2 additions & 2 deletions lib/ACF/DynamicEventGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,10 @@ protected function get_choices_by_name( string $name, array $field ) : array {

$cache_key = 'events-' . $name;
$response = wp_cache_get( $cache_key );
$lang_key = Localization::get_current_language();

if ( ! $response ) {
if ( ! $response && ( $lang_key === 'fi' || $lang_key === 'en' ) ) {
try {
$lang_key = Localization::get_current_language();
$client = new EventzClient( PIRKANMAA_EVENTZ_API_URL, PIRKANMAA_EVENTZ_API_KEY );
$response = $client->{'get_' . $name }( $lang_key );

Expand Down

0 comments on commit 4ad502d

Please sign in to comment.