30
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-06-21 23:42:23 +00:00

Adapt layout categories tree to com_content

This commit is contained in:
chmst 2021-09-21 13:41:15 +02:00
parent 8aa92f906b
commit 6372c9996a

View File

@ -16,18 +16,20 @@ use Joomla\Component\Weblinks\Site\Helper\RouteHelper;
if ($this->maxLevelcat != 0 && count($this->items[$this->parent->id]) > 0) : if ($this->maxLevelcat != 0 && count($this->items[$this->parent->id]) > 0) :
?> ?>
<?php foreach ($this->items[$this->parent->id] as $id => $item) : ?> <div class="com-weblinks-categories__items">
<?php if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) : ?> <?php foreach ($this->items[$this->parent->id] as $id => $item) : ?>
<div class="com-weblinks-categories__items"> <?php if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) : ?>
<h3 class="page-header item-title"> <div class="com-content-categories__item">
<a href="<?php echo Route::_(RouteHelper::getCategoryRoute($item->id, $item->language)); ?>"> <div>
<?php echo $this->escape($item->title); ?></a> <a href="<?php echo Route::_(RouteHelper::getCategoryRoute($item->id, $item->language)); ?>">
<?php if ($this->params->get('show_cat_num_links_cat') == 1) :?> <?php echo $this->escape($item->title); ?></a>
<span class="badge bg-info"> <?php if ($this->params->get('show_cat_num_links_cat') == 1) :?>
<?php echo Text::_('COM_WEBLINKS_NUM_ITEMS'); ?>&nbsp; <span class="badge bg-info">
<?php echo $item->numitems; ?> <?php echo Text::_('COM_WEBLINKS_NUM_ITEMS'); ?>&nbsp;
</span> <?php echo $item->numitems; ?>
<?php endif; ?> </span>
<?php endif; ?>
</div>
<?php if ($this->maxLevelcat > 1 && count($item->getChildren()) > 0) : ?> <?php if ($this->maxLevelcat > 1 && count($item->getChildren()) > 0) : ?>
<button <button
type="button" type="button"
@ -40,17 +42,20 @@ if ($this->maxLevelcat != 0 && count($this->items[$this->parent->id]) > 0) :
<span class="icon-plus" aria-hidden="true"></span> <span class="icon-plus" aria-hidden="true"></span>
</button> </button>
<?php endif; ?> <?php endif; ?>
</h3> <?php if ($this->params->get('show_description_image') && $item->getParams()->get('image')) : ?>
<?php if ($this->params->get('show_subcat_desc_cat') == 1) : ?> <img src="<?php echo $item->getParams()->get('image'); ?>" alt="<?php echo htmlspecialchars($item->getParams()->get('image_alt'), ENT_COMPAT, 'UTF-8'); ?>">
<?php if ($item->description) : ?> <?php endif; ?>
<div class="category-desc"> <?php if ($this->params->get('show_subcat_desc_cat') == 1) : ?>
<?php echo HTMLHelper::_('content.prepare', $item->description, '', 'com_weblinks.categories'); ?> <?php if ($item->description) : ?>
</div> <div class="com-content-categories__description category-desc">
<?php echo HTMLHelper::_('content.prepare', $item->description, '', 'com_weblinks.categories'); ?>
</div>
<?php endif; ?>
<?php endif; ?> <?php endif; ?>
<?php endif; ?>
<?php if ($this->maxLevelcat > 1 && count($item->getChildren()) > 0) : ?> <?php if ($this->maxLevelcat > 1 && count($item->getChildren()) > 0) : ?>
<div class="com-weblinks-categories__children" id="category-<?php echo $item->id; ?>" hidden> <?php if (count($item->getChildren()) > 0 && $this->maxLevelcat > 1) : ?>
<div class="com-content-categories__children" id="category-<?php echo $item->id; ?>" hidden="">
<?php <?php
$this->items[$item->id] = $item->getChildren(); $this->items[$item->id] = $item->getChildren();
$this->parent = $item; $this->parent = $item;
@ -59,9 +64,11 @@ if ($this->maxLevelcat != 0 && count($this->items[$this->parent->id]) > 0) :
$this->parent = $item->getParent(); $this->parent = $item->getParent();
$this->maxLevelcat++; $this->maxLevelcat++;
?> ?>
</div> </div>
<?php endif; ?>
<?php endif; ?>
</div>
<?php endif; ?> <?php endif; ?>
</div> <?php endforeach; ?>
<?php endif; ?> </div>
<?php endforeach; ?>
<?php endif; ?> <?php endif; ?>