diff --git a/administrator/components/com_finder/config.xml b/administrator/components/com_finder/config.xml index c9a020fdd524a..4e91a88f52b3d 100644 --- a/administrator/components/com_finder/config.xml +++ b/administrator/components/com_finder/config.xml @@ -37,6 +37,25 @@ showon="show_description:1" /> + + + + + + + + + + + params->get('show_image', 0); + +if ($showImage && !empty($this->result->getElement('imageUrl'))) +{ + $imageclass = $this->params->get('image_class', ''); + $image = HTMLHelper::cleanImageURL($this->result->getElement('imageUrl')); + $extraAttr = ''; + + // Set lazyloading only for images which have width and height attributes + if ((isset($image->attributes['width']) && (int) $image->attributes['width'] > 0) + && (isset($image->attributes['height']) && (int) $image->attributes['height'] > 0)) + { + $extraAttr = ArrayHelper::toString($image->attributes) . ' loading="lazy"'; + } +} + $icon = ''; if (!empty($this->result->mime)) : $icon = ' '; @@ -72,6 +89,14 @@ result->title; ?>

+ +
+ <?php echo htmlspecialchars($this->result->getElement('imageAlt'), ENT_COMPAT, 'UTF-8'); ?> + /> +
+

result->start_date && $this->params->get('show_date', 1)) : ?> diff --git a/plugins/finder/content/content.php b/plugins/finder/content/content.php index fb797b5952921..4bf6e550f93cc 100644 --- a/plugins/finder/content/content.php +++ b/plugins/finder/content/content.php @@ -295,6 +295,15 @@ protected function index(Result $item) $item->title = $title; } + $images = json_decode($item->images); + + // Add the image. + if (!empty($images) && $images->image_intro) + { + $item->setElement('imageUrl', $images->image_intro); + $item->setElement('imageAlt', $images->image_intro_alt ?? ''); + } + // Add the meta author. $item->metaauthor = $item->metadata->get('author');