fix alt description for image

This commit is contained in:
chmst 2021-09-26 10:51:30 +02:00
parent 9f53917bf7
commit 859fb5a2a0
1 changed files with 23 additions and 11 deletions

View File

@ -21,8 +21,8 @@ if ($this->maxLevelcat != 0 && count($this->items[$this->parent->id]) > 0) :
<?php if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) : ?>
<div class="com-content-categories__item">
<div>
<a href="<?php echo Route::_(RouteHelper::getCategoryRoute($item->id, $item->language)); ?>">
<?php echo $this->escape($item->title); ?></a>
<a href="<?php echo Route::_(RouteHelper::getCategoryRoute($item->id, $item->language)); ?>">
<?php echo $this->escape($item->title); ?></a>
<?php if ($this->params->get('show_cat_num_links_cat') == 1) :?>
<span class="badge bg-info">
<?php echo Text::_('COM_WEBLINKS_NUM_ITEMS'); ?>&nbsp;
@ -30,16 +30,28 @@ if ($this->maxLevelcat != 0 && count($this->items[$this->parent->id]) > 0) :
</span>
<?php endif; ?>
</div>
<?php if ($this->params->get('show_subcat_desc_cat') == 1) : ?>
<?php if ($item->description) : ?>
<div class="category-desc">
<?php echo HTMLHelper::_('content.prepare', $item->description, '', 'com_weblinks.categories'); ?>
</div>
<?php endif; ?>
<?php if ($this->params->get('show_subcat_desc_cat') == 1 && !empty($item->description)) : ?>
<div class="category-desc">
<?php echo HTMLHelper::_('content.prepare', $item->description, '', 'com_weblinks.categories'); ?>
</div>
<?php endif; ?>
<?php if ($this->params->get('show_description_image') && $item->getParams()->get('image')) : ?>
<img src="<?php echo $item->getParams()->get('image'); ?>" alt="<?php echo htmlspecialchars($item->getParams()->get('image_alt'), ENT_COMPAT, 'UTF-8'); ?>">
<?php endif; ?> <?php if ($this->maxLevelcat > 1 && count($item->getChildren()) > 0) : ?>
<?php if ($this->params->get('show_description_image') && !empty($item->getParams()->get('image'))) : ?>
<?php
$params = $item->getParams();
$img = HTMLHelper::cleanImageURL($params->get('image'));
$alt = '';
if (!empty($params->get('image_alt'))) :
$alt = 'alt="' . htmlspecialchars($params->get('image_alt'), ENT_COMPAT, 'UTF-8') . '"';
elseif (!empty($params->get('image_alt_empty'))) :
$alt = 'alt=""';
endif;
?>
<img src="<?php echo htmlspecialchars($img->url, ENT_COMPAT, 'UTF-8'); ?>"<?php echo $alt; ?>>
<?php endif; ?>
<?php if ($this->maxLevelcat > 1 && count($item->getChildren()) > 0) : ?>
<button
type="button"
id="category-btn-<?php echo $item->id; ?>"