mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2025-01-12 07:55:53 +00:00
Merge pull request #7 from chmst/images-weblink
4.0 compatible - Add images to weblink single view
This commit is contained in:
commit
425daabf42
@ -10,6 +10,7 @@
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\String\PunycodeHelper;
|
||||
|
||||
$weblinkUrl = PunycodeHelper::urlToUTF8($this->item->url);
|
||||
@ -29,7 +30,52 @@ $weblinkUrl = PunycodeHelper::urlToUTF8($this->item->url);
|
||||
<a href="<?php echo $weblinkUrl; ?>" target="_blank" itemprop="url">
|
||||
<?php echo $weblinkUrl; ?>
|
||||
</a>
|
||||
<?php echo $this->item->description; ?>
|
||||
|
||||
<?php if (($this->params->get('show_link_description')) && ($this->item->description != '')) : ?>
|
||||
<div class="mt-2 mb-2">
|
||||
<?php $images = json_decode($this->item->images); ?>
|
||||
<?php if (!empty($images->image_first)) : ?>
|
||||
<?php $imgFloat = '';
|
||||
if (!empty($images->float_first)) :
|
||||
$imgFloat = $images->float_first == 'right' ? 'float-end' : 'float-start';
|
||||
endif;
|
||||
$img = HTMLHelper::cleanImageURL($images->image_first);
|
||||
$alt = empty($images->image_first_alt) && empty($images->image_first_alt_empty)
|
||||
? ''
|
||||
: 'alt="' . htmlspecialchars($images->image_first_alt, ENT_COMPAT, 'UTF-8') . '"';
|
||||
?>
|
||||
<figure class="item-image <?php echo $imgFloat; ?>">
|
||||
<img src="<?php echo htmlspecialchars($img->url, ENT_COMPAT, 'UTF-8'); ?>"
|
||||
<?php echo $alt; ?> itemprop="thumbnail" />
|
||||
<?php if (!empty($images->image_first_caption)) : ?>
|
||||
<figcaption class="caption"><?php echo htmlspecialchars($images->image_first_caption, ENT_COMPAT, 'UTF-8'); ?></figcaption>
|
||||
<?php endif; ?>
|
||||
</figure>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($images->image_second)) : ?>
|
||||
<?php $imgFloat = '';
|
||||
if (!empty($images->float_second)) :
|
||||
$imgFloat = $images->float_second == 'right' ? 'float-end' : 'float-start';
|
||||
endif;
|
||||
$img = HTMLHelper::cleanImageURL($images->image_second);
|
||||
$alt = empty($images->image_first_alt) && empty($images->image_second_alt_empty)
|
||||
? ''
|
||||
: 'alt="' . htmlspecialchars($images->image_second_alt, ENT_COMPAT, 'UTF-8') . '"';
|
||||
?>
|
||||
<figure class="item-image <?php echo $imgFloat; ?>">
|
||||
<img src="<?php echo htmlspecialchars($img->url, ENT_COMPAT, 'UTF-8'); ?>"
|
||||
<?php echo $alt; ?> itemprop="thumbnail" />
|
||||
<?php if (!empty($images->image_second_caption)) : ?>
|
||||
<figcaption class="caption"><?php echo htmlspecialchars($images->image_second_caption, ENT_COMPAT, 'UTF-8'); ?></figcaption>
|
||||
<?php endif; ?>
|
||||
</figure>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $this->item->description; ?>
|
||||
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php // Content is generated by content plugin event "onContentAfterDisplay" ?>
|
||||
<?php echo $this->item->event->afterDisplayContent; ?>
|
||||
|
Loading…
Reference in New Issue
Block a user