[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_content/tmpl/category/ -> blog_children.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\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  if ($this->maxLevel != 0 && count($this->children[$this->category->id]) > 0) : ?>
  24      <?php foreach ($this->children[$this->category->id] as $id => $child) : ?>
  25          <?php // Check whether category access level allows access to subcategories. ?>
  26          <?php if (in_array($child->access, $groups)) : ?>
  27              <?php if ($this->params->get('show_empty_categories') || $child->numitems || count($child->getChildren())) : ?>
  28              <div class="com-content-category-blog__child">
  29                  <?php if ($lang->isRtl()) : ?>
  30                  <h3 class="page-header item-title">
  31                      <?php if ($this->params->get('show_cat_num_articles', 1)) : ?>
  32                          <span class="badge bg-info tip">
  33                              <?php echo $child->getNumItems(true); ?>
  34                          </span>
  35                      <?php endif; ?>
  36                      <a href="<?php echo Route::_(RouteHelper::getCategoryRoute($child->id, $child->language)); ?>">
  37                      <?php echo $this->escape($child->title); ?></a>
  38  
  39                      <?php if ($this->maxLevel > 1 && count($child->getChildren()) > 0) : ?>
  40                          <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>
  41                      <?php endif; ?>
  42                  </h3>
  43                  <?php else : ?>
  44                  <h3 class="page-header item-title"><a href="<?php echo Route::_(RouteHelper::getCategoryRoute($child->id, $child->language)); ?>">
  45                      <?php echo $this->escape($child->title); ?></a>
  46                      <?php if ($this->params->get('show_cat_num_articles', 1)) : ?>
  47                          <span class="badge bg-info">
  48                              <?php echo Text::_('COM_CONTENT_NUM_ITEMS'); ?>&nbsp;
  49                              <?php echo $child->getNumItems(true); ?>
  50                          </span>
  51                      <?php endif; ?>
  52  
  53                      <?php if ($this->maxLevel > 1 && count($child->getChildren()) > 0) : ?>
  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  
  59                  <?php if ($this->params->get('show_subcat_desc') == 1) : ?>
  60                      <?php if ($child->description) : ?>
  61                      <div class="com-content-category-blog__description category-desc">
  62                          <?php echo HTMLHelper::_('content.prepare', $child->description, '', 'com_content.category'); ?>
  63                      </div>
  64                      <?php endif; ?>
  65                  <?php endif; ?>
  66  
  67                  <?php if ($this->maxLevel > 1 && count($child->getChildren()) > 0) : ?>
  68                  <div class="com-content-category-blog__children collapse fade" id="category-<?php echo $child->id; ?>">
  69                      <?php
  70                      $this->children[$child->id] = $child->getChildren();
  71                      $this->category = $child;
  72                      $this->maxLevel--;
  73                      echo $this->loadTemplate('children');
  74                      $this->category = $child->getParent();
  75                      $this->maxLevel++;
  76                      ?>
  77                  </div>
  78                  <?php endif; ?>
  79              </div>
  80              <?php endif; ?>
  81          <?php endif; ?>
  82      <?php endforeach; ?>
  83  
  84  <?php endif;


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