Skip to content

Commit

Permalink
Merge branch 'master' into TMS-1018
Browse files Browse the repository at this point in the history
  • Loading branch information
eebbi authored Mar 18, 2024
2 parents 4f8d764 + 3a30f13 commit 23f26b2
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 24 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [1.54.6] - 2024-03-18

- TMS-996: Change bold image-caption text to normal
- TMS-1009: Fix error when fetching Eventz response with languages other than fi & en
- TMS-1015: Header accessibility fixes
- TMS-1017: Add image alt-text to imported news
- TMS-1018: Remove external-link icons from imported news image links

## [1.54.5] - 2024-02-01
Expand Down
19 changes: 14 additions & 5 deletions lib/ACF/DynamicEventGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,19 @@ protected function get_choices_by_name( string $name, array $field ) : array {
return $field;
}

$cache_key = 'events-' . $name;
$response = wp_cache_get( $cache_key );
$cache_key = 'events-' . $name;
$response = wp_cache_get( $cache_key );
$lang_key = Localization::get_current_language();
$request_allowed_langs = [
'fi',
'en',
];

if ( ! $response ) {
if (
! $response &&
in_array( $lang_key, $request_allowed_langs, true )
) {
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 All @@ -307,7 +314,9 @@ protected function get_choices_by_name( string $name, array $field ) : array {

if ( ! empty( $response ) ) {
foreach ( $response as $item ) {
$field['choices'][ $item->_id ] = $item->name;
if ( isset( $item->_id ) ) {
$field['choices'][ $item->_id ] = $item->name;
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion lib/Traits/EnrichPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ public static function enrich_post(
int $excerpt_length = 160
) {
if ( $use_images ) {
$api_image = get_field( 'image_url', $post->ID );
$api_image = get_field( 'image_url', $post->ID );
$api_image_alt = get_field( 'image_alt', $post->ID );

if ( ! empty( $api_image ) ) {
$post->api_image_url = $api_image;
$post->api_image_alt = $api_image_alt;
}
else {
$post->featured_image = has_post_thumbnail( $post->ID )
Expand Down
2 changes: 2 additions & 0 deletions models/single.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public function content() {
: $single->image;

$single->api_image_url = empty( $single->image ) ? get_field( 'image_url' ) : false;
$single->api_image_alt = empty( $single->image ) ? get_field( 'image_alt' ) : false;
$single->has_image = ! empty( $single->image ) || ! empty( $single->api_image_url );

if ( 'blog-article' === $single->post_type ) {
Expand Down Expand Up @@ -141,6 +142,7 @@ public function related() : ?array {
}

$item->api_image_url = get_field( 'image_url', $item->ID );
$item->api_image_alt = get_field( 'image_alt', $item->ID );
$has_image = $item->image_id !== 0 || ! empty( $item->api_image_url );

if ( ! $has_image ) {
Expand Down
4 changes: 2 additions & 2 deletions partials/shared/header-inner.dust
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

{?Header.lang_nav_horizontal}
<div class="is-hidden-touch">
{>"ui/menu/language-nav" links=Header.language_nav.links /}
{>"ui/menu/language-nav" links=Header.language_nav.links id="lang-menu" /}
</div>
{/Header.lang_nav_horizontal}

{?Header.lang_nav_horizontal}
<div class="is-hidden-desktop">
{?Header.language_nav.links_without_current}
{>"ui/menu/language-nav" links=Header.language_nav.links_without_current /}
{>"ui/menu/language-nav" links=Header.language_nav.links_without_current id="lang-menu-mobile" /}
{:else}
{>"ui/menu/language-nav-dropdown" links=Header.language_nav.links /}
{/Header.language_nav.links_without_current}
Expand Down
4 changes: 3 additions & 1 deletion partials/single.dust
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@

{?content.api_image_url}
<div class="entry__figure pt-2">
<img src="{content.api_image_url|url}" loading="lazy" />
<img src="{content.api_image_url|url}"
{?content.api_image_alt}alt="{content.api_image_alt|attr}"{/content.api_image_alt}
loading="lazy" />
</div>

{>"views/single/single-meta" spacing_class="pt-5 pt-4-desktop pb-5 p-5-tablet" /}
Expand Down
6 changes: 3 additions & 3 deletions partials/ui/image/image-caption.dust
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="columns pt-2">
<div class="columns mb-1 pt-2">
<div
class="column is-flex is-justify-content-space-between is-flex-wrap-wrap has-text-small">
<strong class="is-inline-block">
<p class="is-inline-block m-0">
{image.caption|kses}
</strong>
</p>
</div>
</div>
2 changes: 1 addition & 1 deletion partials/ui/menu/language-nav.dust
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{?links.all}
<nav aria-label="{Strings.s.header.language_navigation|s}">
<ul id="lang-menu"
<ul id="{id|attr}"
class="lang-nav--horizontal ml-6-desktop is-flex is-unstyled is-uppercase has-text-weight-semibold is-family-secondary">
{#links.all}
<li class="ml-2-desktop">
Expand Down
10 changes: 5 additions & 5 deletions partials/ui/menu/menu-item-dropdown.dust
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<li class="navbar-item has-dropdown {#classes}{.}{@sep} {/sep}{/classes}">
<div class="navbar-dropdown-control">
<a class="navbar-link dropdown-trigger is-arrowless" href="#">
{title|s}
{title|html}
</a>

<button class="dropdown-toggler" aria-expanded=false aria-controls="js-navbar-menu-item-dropdown-{$idx}">
<span class="is-sr-only">{data.open_menu|s}</span>
{Strings.s}
<button class="dropdown-toggler" aria-expanded=false aria-controls="js-navbar-menu-item-dropdown-{$idx|attr}">
<span class="is-sr-only">{data.open_menu|html}</span>
{Strings.s|html}

<span aria-hidden="true">
{>"ui/icon" icon="chevron-down" class="icon--medium" /}
Expand All @@ -20,6 +20,6 @@
</div>

{>"ui/menu/menu-item-dropdown-content" /}

</li>
{/sub_menu}
10 changes: 5 additions & 5 deletions partials/ui/menu/menu-item.dust
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
{?sub_menu}
<li class="navbar-item has-dropdown {#classes}{.}{@sep} {/sep}{/classes}">
<div class="navbar-dropdown-control">
<a class="navbar-link is-arrowless" href="{url}">
{title|s}
<a class="navbar-link is-arrowless" href="{url|url}">
{title|html}
</a>

<button class="dropdown-toggler" aria-expanded=false aria-controls="js-navbar-menu-item-{$idx}">
<span class="is-sr-only">{data.open_menu|s}</span>
<button class="dropdown-toggler" aria-expanded=false aria-controls="js-navbar-menu-item-{$idx|attr}">
<span class="is-sr-only">{data.open_menu|html}</span>

<span aria-hidden="true">
{>"ui/icon" icon="chevron-down" class="icon--medium" /}
</span>
</button>
</div>

<div class="navbar-dropdown is-hidden-touch" id="js-navbar-menu-item-{$idx}">
<div class="navbar-dropdown is-hidden-touch" id="js-navbar-menu-item-{$idx|attr}">
{#sub_menu}
{>"ui/menu/menu-item-simple" /}
{/sub_menu}
Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Theme Name: TMS Theme Base
* Description: Tampere Multisite Base Theme
* Domain Path: /lang
* Version: 1.54.5
* Version: 1.54.6
* Author: Geniem
* Author URI: https://geniem.fi
* Text Domain: tms-theme-base
Expand Down

0 comments on commit 23f26b2

Please sign in to comment.