[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_content/tmpl/categories/ -> default_items.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  com_content
   6   *
   7   * @copyright   (C) 2010 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\HTML\HTMLHelper;
  14  use Joomla\CMS\Language\Text;
  15  use Joomla\CMS\Router\Route;
  16  use Joomla\Component\Content\Site\Helper\RouteHelper;
  17  
  18  if ($this->maxLevelcat != 0 && count($this->items[$this->parent->id]) > 0) :
  19      ?>
  20      <div class="com-content-categories__items">
  21          <?php foreach ($this->items[$this->parent->id] as $id => $item) : ?>
  22              <?php if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) : ?>
  23              <div class="com-content-categories__item">
  24                  <div class="com-content-categories__item-title-wrapper">
  25                      <div class="com-content-categories__item-title">
  26                          <a href="<?php echo Route::_(RouteHelper::getCategoryRoute($item->id, $item->language)); ?>">
  27                          <?php echo $this->escape($item->title); ?></a>
  28                          <?php if ($this->params->get('show_cat_num_articles_cat') == 1) :?>
  29                              <span class="badge bg-info">
  30                                  <?php echo Text::_('COM_CONTENT_NUM_ITEMS'); ?>&nbsp;
  31                                  <?php echo $item->numitems; ?>
  32                              </span>
  33                          <?php endif; ?>
  34                      </div>
  35                      <?php if (count($item->getChildren()) > 0 && $this->maxLevelcat > 1) : ?>
  36                          <button
  37                              type="button"
  38                              id="category-btn-<?php echo $item->id; ?>"
  39                              data-category-id="<?php echo $item->id; ?>"
  40                              class="btn btn-secondary btn-sm"
  41                              aria-expanded="false"
  42                              aria-label="<?php echo Text::_('JGLOBAL_EXPAND_CATEGORIES'); ?>"
  43                          >
  44                              <span class="icon-plus" aria-hidden="true"></span>
  45                          </button>
  46                      <?php endif; ?>
  47                  </div>
  48                  <?php if ($this->params->get('show_description_image') && $item->getParams()->get('image')) : ?>
  49                      <?php echo HTMLHelper::_('image', $item->getParams()->get('image'), $item->getParams()->get('image_alt')); ?>
  50                  <?php endif; ?>
  51                  <?php if ($this->params->get('show_subcat_desc_cat') == 1) : ?>
  52                      <?php if ($item->description) : ?>
  53                          <div class="com-content-categories__description category-desc">
  54                              <?php echo HTMLHelper::_('content.prepare', $item->description, '', 'com_content.categories'); ?>
  55                          </div>
  56                      <?php endif; ?>
  57                  <?php endif; ?>
  58  
  59                  <?php if (count($item->getChildren()) > 0 && $this->maxLevelcat > 1) : ?>
  60                      <div class="com-content-categories__children" id="category-<?php echo $item->id; ?>" hidden="">
  61                      <?php
  62                      $this->items[$item->id] = $item->getChildren();
  63                      $this->parent = $item;
  64                      $this->maxLevelcat--;
  65                      echo $this->loadTemplate('items');
  66                      $this->parent = $item->getParent();
  67                      $this->maxLevelcat++;
  68                      ?>
  69                      </div>
  70                  <?php endif; ?>
  71              </div>
  72              <?php endif; ?>
  73          <?php endforeach; ?>
  74      </div>
  75  <?php endif; ?>


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