Skip to content

Commit

Permalink
Merge pull request #313 from devgeniem/TMS-564
Browse files Browse the repository at this point in the history
Tms 564: Image metadata formatting
  • Loading branch information
tim0haapala authored Dec 15, 2021
2 parents a3280f9 + c04abfc commit 89195b7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changed

- TMS-564: Image metadata formatting.
- TMS-561: Adjust sitemap button styles #311

## [1.30.2] - 2021-12-14
Expand Down
19 changes: 7 additions & 12 deletions lib/Formatters/ImageFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,15 @@ public static function get_image_artist( array $row, array $image ) : array {
$row['artist_name'] = trim( get_field( 'artist_name', $image_id ) );
$row['image_title'] = trim( $image['title'] ?? '' );

if ( ! empty( $row['artist_name'] ) && ! empty( $row['image_title'] ) ) {
$row['image_title_and_artist'] = sprintf(
'%s: %s',
$row['artist_name'],
$row['image_title']
);
if ( ! empty( $row['artist_name'] ) ) {
$row['image_title_and_artist'] .= sprintf( '%s: ', $row['artist_name'] );
}
elseif ( ! empty( $row['author_name'] ) ) {
$row['image_title_and_artist'] .= sprintf( '%s: ', $row['author_name'] );
}

if ( ! empty( $row['author_name'] ) && ! empty( $row['image_title'] ) ) {
$row['image_author_and_artist'] = sprintf(
'%s: %s',
$row['author_name'],
$row['image_title']
);
if ( ! empty( $row['image_title'] ) ) {
$row['image_title_and_artist'] .= sprintf( '%s.', $row['image_title'] );
}

return $row;
Expand Down
2 changes: 1 addition & 1 deletion partials/ui/image/image-block__meta.dust
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="columns image-block__meta pt-2{?author_name} is-reversed{/author_name}">
{?author_name}
<div class="column is-2 has-text-right image-block__author-name has-text-small">
{author_name|s}
{author_name|s}.
</div>
{/author_name}
{?caption}
Expand Down

0 comments on commit 89195b7

Please sign in to comment.