[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_content/tmpl/category/ -> default_children.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  com_content
   6   *
   7   * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  defined('_JEXEC') or die;
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\HTML\HTMLHelper;
  15  use Joomla\CMS\Language\Text;
  16  use Joomla\CMS\Router\Route;
  17  use Joomla\Component\Content\Site\Helper\RouteHelper;
  18  
  19  $lang   = Factory::getLanguage();
  20  $user   = Factory::getUser();
  21  $groups = $user->getAuthorisedViewLevels();
  22  ?>
  23  
  24  <?php if (count($this->children[$this->category->id]) > 0) : ?>
  25      <?php foreach ($this->children[$this->category->id] as $id => $child) : ?>
  26          <?php // Check whether category access level allows access to subcategories. ?>
  27          <?php if (in_array($child->access, $groups)) : ?>
  28              <?php if ($this->params->get('show_empty_categories') || $child->getNumItems(true) || count($child->getChildren())) : ?>
  29              <div class="com-content-category__children">
  30                  <?php if ($lang->isRtl()) : ?>
  31                  <h3 class="page-header item-title">
  32                      <?php if ($this->params->get('show_cat_num_articles', 1)) : ?>
  33                          <span class="badge bg-info tip hasTooltip" title="<?php echo HTMLHelper::_('tooltipText', 'COM_CONTENT_NUM_ITEMS'); ?>">
  34                              <?php echo $child->getNumItems(true); ?>
  35                          </span>
  36                      <?php endif; ?>
  37                      <a href="<?php echo Route::_(RouteHelper::getCategoryRoute($child->id, $child->language)); ?>">
  38                      <?php echo $this->escape($child->title); ?></a>
  39  
  40                      <?php if (count($child->getChildren()) > 0 && $this->maxLevel > 1) : ?>
  41                          <a href="#category-<?php echo $child->id; ?>" data-bs-toggle="collapse" class="btn btn-sm float-end" aria-label="<?php echo Text::_('JGLOBAL_EXPAND_CATEGORIES'); ?>"><span class="icon-plus" aria-hidden="true"></span></a>
  42                      <?php endif; ?>
  43                  </h3>
  44                  <?php else : ?>
  45                  <h3 class="page-header item-title"><a href="<?php echo Route::_(RouteHelper::getCategoryRoute($child->id, $child->language)); ?>">
  46                      <?php echo $this->escape($child->title); ?></a>
  47                      <?php if ($this->params->get('show_cat_num_articles', 1)) : ?>
  48                          <span class="badge bg-info tip hasTooltip" title="<?php echo HTMLHelper::_('tooltipText', 'COM_CONTENT_NUM_ITEMS'); ?>">
  49                              <?php echo $child->getNumItems(true); ?>
  50                          </span>
  51                      <?php endif; ?>
  52  
  53                      <?php if (count($child->getChildren()) > 0 && $this->maxLevel > 1) : ?>
  54                          <a href="#category-<?php echo $child->id; ?>" data-bs-toggle="collapse" class="btn btn-sm float-end" aria-label="<?php echo Text::_('JGLOBAL_EXPAND_CATEGORIES'); ?>"><span class="icon-plus" aria-hidden="true"></span></a>
  55                      <?php endif; ?>
  56                  </h3>
  57                  <?php endif; ?>
  58                  <?php if ($this->params->get('show_subcat_desc') == 1) : ?>
  59                      <?php if ($child->description) : ?>
  60                          <div class="category-desc">
  61                              <?php echo HTMLHelper::_('content.prepare', $child->description, '', 'com_content.category'); ?>
  62                          </div>
  63                      <?php endif; ?>
  64                  <?php endif; ?>
  65  
  66                  <?php if (count($child->getChildren()) > 0 && $this->maxLevel > 1) : ?>
  67                  <div class="collapse fade" id="category-<?php echo $child->id; ?>">
  68                      <?php
  69                      $this->children[$child->id] = $child->getChildren();
  70                      $this->category = $child;
  71                      $this->maxLevel--;
  72                      echo $this->loadTemplate('children');
  73                      $this->category = $child->getParent();
  74                      $this->maxLevel++;
  75                      ?>
  76                  </div>
  77                  <?php endif; ?>
  78  
  79              </div>
  80              <?php endif; ?>
  81          <?php endif; ?>
  82      <?php endforeach; ?>
  83  <?php endif; ?>


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer