Skip to content

Commit

Permalink
fix: dates post module (#816)
Browse files Browse the repository at this point in the history
  • Loading branch information
NiclasNorin authored Feb 10, 2025
1 parent 6be7d8d commit 01a02e2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public function addDataViewData(array $data, array $fields)
ColumnHelper::getFirstColumnSize($data['posts_columns']) :
false;
$data['imagePosition'] = $fields['image_position'] ?? false;
$data['showDate'] = in_array('date', $fields['posts_fields'] ?? []);


return $data;
}
Expand Down Expand Up @@ -205,7 +207,6 @@ private function setPostViewData(object $post, $index = false)
$post->images ?? null,
$post->imageContract ?? null
) : [];
$post->postDateFormatted = in_array('date', $this->data['posts_fields'] ?? []) ? $post->postDateFormatted : false;
$post->hasPlaceholderImage = in_array('image', $this->data['posts_fields'] ?? []) && empty($post->image) ? true : false;
$post->commentCount = in_array('comment_count', $this->data['posts_fields'] ?? []) ? (string) $post->getCommentCount() : false;
$post->readingTime = in_array('reading_time', $this->data['posts_fields'] ?? []) ? $post->readingTime : false;
Expand Down
4 changes: 2 additions & 2 deletions source/php/Module/Posts/views/partials/post/block.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
'ratio' => $ratio,
'meta' => $post->termsUnlinked,
'secondaryMeta' => $post->readingTime,
'date' => [
'date' => $showDate ? [
'timestamp' => $post->getArchiveDateTimestamp(),
'format' => $post->getArchiveDateFormat(),
],
] : null,
'dateBadge' => $post->getArchiveDateFormat() == 'date-badge',
'image' => $post->image,
'classList' => ['t-posts-block', ' u-height--100'],
Expand Down
4 changes: 2 additions & 2 deletions source/php/Module/Posts/views/partials/post/box.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
'content' => $post->excerptShort,
'link' => $post->permalink,
'meta' => $post->termsUnlinked,
'date' => [
'date' => $showDate ? [
'timestamp' => $post->getArchiveDateTimestamp(),
'format' => $post->getArchiveDateFormat(),
],
] : null,
'dateBadge' => $post->getArchiveDateFormat() == 'date-badge',
'ratio' => $ratio,
'image' => $post->imageContract ?? $post->image,
Expand Down
4 changes: 2 additions & 2 deletions source/php/Module/Posts/views/partials/post/card.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
'context' => ['module.posts.index'],
'content' => $post->excerptShort,
'tags' => $post->termsUnlinked,
'date' => [
'date' => $showDate ? [
'timestamp' => $post->getArchiveDateTimestamp(),
'format' => $post->getArchiveDateFormat(),
],
] : null,
'dateBadge' => $post->getArchiveDateFormat() == 'date-badge',
'classList' => ['u-height--100'],
'containerAware' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
'heading' => $post->postTitle,
'content' => $post->excerpt,
'image' => $post->image,
'date' => [
'date' => $showDate ? [
'timestamp' => $post->getArchiveDateTimestamp(),
'format' => $post->getArchiveDateFormat(),
],
] : null,
'readTime' => $post->readingTime,
'link' => $post->permalink,
'context' => ['module.posts.news-item'],
Expand Down
4 changes: 2 additions & 2 deletions source/php/Module/Posts/views/partials/post/segment.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
'context' => ['module.posts.segment'],
'tags' => $post->termsUnlinked,
'image' => $post->image,
'date' => [
'date' => $showDate ? [
'timestamp' => $post->getArchiveDateTimestamp(),
'format' => $post->getArchiveDateFormat(),
],
] : null,
'content' => $post->excerptShort,
'buttons' => [['text' => $lang['readMore'], 'href' => $post->permalink, 'color' => 'primary']],
'containerAware' => true,
Expand Down

0 comments on commit 01a02e2

Please sign in to comment.