Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 16 additions & 40 deletions modules/mod_banners/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Joomla\CMS\Helper\MediaHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
?>
Expand Down Expand Up @@ -40,6 +41,17 @@
<?php $alt = $alt ?: Text::_('MOD_BANNERS_BANNER'); ?>
<?php $width = $item->params->get('width'); ?>
<?php $height = $item->params->get('height'); ?>
<?php $imageAttribs = [
'src' => $baseurl . $imageurl,
'alt' => $alt
];?>
<?php if (!empty($width)) : ?>
<?php $imageAttributes['width'] = $width; ?>
<?php endif; ?>
<?php if (!empty($height)) : ?>
<?php $imageAttributes['height'] = $height; ?>
<?php endif; ?>
<?php $image = LayoutHelper::render('joomla.html.image', $imageAttribs); ?>
<?php if ($item->clickurl) : ?>
<?php // Wrap the banner in a link ?>
<?php $target = $params->get('target', 1); ?>
Expand All @@ -48,16 +60,7 @@
<a
href="<?php echo $link; ?>" target="_blank" rel="noopener noreferrer"
title="<?php echo htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8'); ?>">
<img
src="<?php echo $baseurl . $imageurl; ?>"
alt="<?php echo htmlspecialchars($alt, ENT_QUOTES, 'UTF-8'); ?>"
<?php if (!empty($width)) {
echo 'width="' . $width . '"';
} ?>
<?php if (!empty($height)) {
echo 'height="' . $height . '"';
} ?>
>
<?php echo $image; ?>
</a>
<?php elseif ($target == 2) : ?>
<?php // Open in a popup window ?>
Expand All @@ -66,46 +69,19 @@
'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550');
return false"
title="<?php echo htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8'); ?>">
<img
src="<?php echo $baseurl . $imageurl; ?>"
alt="<?php echo htmlspecialchars($alt, ENT_QUOTES, 'UTF-8'); ?>"
<?php if (!empty($width)) {
echo 'width="' . $width . '"';
} ?>
<?php if (!empty($height)) {
echo 'height="' . $height . '"';
} ?>
>
<?php echo $image; ?>
</a>
<?php else : ?>
<?php // Open in parent window ?>
<a
href="<?php echo $link; ?>"
title="<?php echo htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8'); ?>">
<img
src="<?php echo $baseurl . $imageurl; ?>"
alt="<?php echo htmlspecialchars($alt, ENT_QUOTES, 'UTF-8'); ?>"
<?php if (!empty($width)) {
echo 'width="' . $width . '"';
} ?>
<?php if (!empty($height)) {
echo 'height="' . $height . '"';
} ?>
>
<?php echo $image; ?>
</a>
<?php endif; ?>
<?php else : ?>
<?php // Just display the image if no link specified ?>
<img
src="<?php echo $baseurl . $imageurl; ?>"
alt="<?php echo htmlspecialchars($alt, ENT_QUOTES, 'UTF-8'); ?>"
<?php if (!empty($width)) {
echo 'width="' . $width . '"';
} ?>
<?php if (!empty($height)) {
echo 'height="' . $height . '"';
} ?>
>
<?php echo $image; ?>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
Expand Down