<?php
    /**
 * @package Helix3 Framework
 * @author JoomShaper https://www.joomshaper.com
 * @copyright (c) 2010 - 2026 JoomShaper
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
 */

    defined('_JEXEC') or die;

    use Joomla\CMS\Helper\ModuleHelper;
    use Joomla\CMS\HTML\HTMLHelper;
    use Joomla\CMS\Router\Route;

foreach ($list as $item): ?>
	<li <?php if ($_SERVER['PHP_SELF'] == Route::_(JVERSION < 4 ? ContentHelperRoute::getCategoryRoute($item->id) : Joomla\Component\Content\Site\Helper\RouteHelper::getCategoryRoute($item->id))) {
                echo ' class="active"';
        }
        ?>>
		<a href="<?php echo Route::_(JVERSION < 4 ? ContentHelperRoute::getCategoryRoute($item->id) : Joomla\Component\Content\Site\Helper\RouteHelper::getCategoryRoute($item->id)); ?>">
		<?php echo $item->title; ?>
			<?php if ($params->get('numitems')): ?>
				(<?php echo $item->numitems; ?>)
			<?php endif; ?>
		</a>

		<?php if ($params->get('show_description', 0)): ?>
			<?php echo HTMLHelper::_('content.prepare', $item->description, $item->getParams(), 'mod_articles_categories.content'); ?>
		<?php endif; ?>
		<?php if ($params->get('show_children', 0) && (($params->get('maxlevel', 0) == 0)
                || ($params->get('maxlevel') >= ($item->level - $startLevel)))
            && count($item->getChildren())): ?>
			<?php echo '<ul>'; ?>
			<?php $temp = $list; ?>
			<?php $list = $item->getChildren(); ?>
			<?php require ModuleHelper::getLayoutPath('mod_articles_categories', $params->get('layout', 'default') . '_items'); ?>
			<?php $list = $temp; ?>
			<?php echo '</ul>'; ?>
		<?php endif; ?>
	</li>
<?php endforeach; ?>
