From ef3492e9b59a15d87ac0b2f53916230c8e2456e7 Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 4 Jan 2024 14:07:32 +0000 Subject: [PATCH] [theme] add data-rating attribute to thumbnails --- core/basethemelet.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/core/basethemelet.php b/core/basethemelet.php index 30fc6372..010b2e1b 100644 --- a/core/basethemelet.php +++ b/core/basethemelet.php @@ -79,16 +79,21 @@ class BaseThemelet } } + $attrs = [ + "href" => $view_link, + "class" => "thumb shm-thumb shm-thumb-link $custom_classes", + "data-tags" => $tags, + "data-height" => $image->height, + "data-width" => $image->width, + "data-mime" => $image->get_mime(), + "data-post-id" => $id, + ]; + if(Extension::is_enabled(RatingsInfo::KEY)) { + $attrs["data-rating"] = $image->rating; + } + return A( - [ - "href" => $view_link, - "class" => "thumb shm-thumb shm-thumb-link $custom_classes", - "data-tags" => $tags, - "data-height" => $image->height, - "data-width" => $image->width, - "data-mime" => $image->get_mime(), - "data-post-id" => $id, - ], + $attrs, IMG( [ "id" => "thumb_$id",