[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_content/tmpl/featured/ -> default_item.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  com_content
   6   *
   7   * @copyright   (C) 2006 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\Language\Associations;
  15  use Joomla\CMS\Language\Text;
  16  use Joomla\CMS\Layout\LayoutHelper;
  17  use Joomla\CMS\Router\Route;
  18  use Joomla\CMS\Uri\Uri;
  19  use Joomla\Component\Content\Administrator\Extension\ContentComponent;
  20  use Joomla\Component\Content\Site\Helper\RouteHelper;
  21  
  22  // Create a shortcut for params.
  23  $params  = &$this->item->params;
  24  $canEdit = $this->item->params->get('access-edit');
  25  $info    = $this->item->params->get('info_block_position', 0);
  26  
  27  // Check if associations are implemented. If they are, define the parameter.
  28  $assocParam = (Associations::isEnabled() && $params->get('show_associations'));
  29  
  30  $currentDate       = Factory::getDate()->format('Y-m-d H:i:s');
  31  $isExpired         = !is_null($this->item->publish_down) && $this->item->publish_down < $currentDate;
  32  $isNotPublishedYet = $this->item->publish_up > $currentDate;
  33  $isUnpublished     = $this->item->state == ContentComponent::CONDITION_UNPUBLISHED || $isNotPublishedYet || $isExpired;
  34  ?>
  35  
  36  <?php echo LayoutHelper::render('joomla.content.intro_image', $this->item); ?>
  37  
  38  <div class="item-content">
  39      <?php if ($isUnpublished) : ?>
  40          <div class="system-unpublished">
  41      <?php endif; ?>
  42  
  43      <?php if ($params->get('show_title')) : ?>
  44          <h2 class="item-title" itemprop="headline">
  45          <?php if ($params->get('link_titles') && $params->get('access-view')) : ?>
  46              <a href="<?php echo Route::_(RouteHelper::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language)); ?>" itemprop="url">
  47                  <?php echo $this->escape($this->item->title); ?>
  48              </a>
  49          <?php else : ?>
  50              <?php echo $this->escape($this->item->title); ?>
  51          <?php endif; ?>
  52          </h2>
  53      <?php endif; ?>
  54  
  55      <?php if ($this->item->state == ContentComponent::CONDITION_UNPUBLISHED) : ?>
  56          <span class="badge bg-warning text-light"><?php echo Text::_('JUNPUBLISHED'); ?></span>
  57      <?php endif; ?>
  58      <?php if ($isNotPublishedYet) : ?>
  59          <span class="badge bg-warning text-light"><?php echo Text::_('JNOTPUBLISHEDYET'); ?></span>
  60      <?php endif; ?>
  61      <?php if ($isExpired) : ?>
  62          <span class="badge bg-warning text-light"><?php echo Text::_('JEXPIRED'); ?></span>
  63      <?php endif; ?>
  64  
  65      <?php if ($canEdit) : ?>
  66          <?php echo LayoutHelper::render('joomla.content.icons', array('params' => $params, 'item' => $this->item)); ?>
  67      <?php endif; ?>
  68  
  69      <?php // Content is generated by content plugin event "onContentAfterTitle" ?>
  70      <?php echo $this->item->event->afterDisplayTitle; ?>
  71  
  72      <?php // @todo Not that elegant would be nice to group the params ?>
  73      <?php $useDefList = ($params->get('show_modify_date') || $params->get('show_publish_date') || $params->get('show_create_date')
  74          || $params->get('show_hits') || $params->get('show_category') || $params->get('show_parent_category') || $params->get('show_author') || $assocParam); ?>
  75  
  76      <?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
  77          <?php echo LayoutHelper::render('joomla.content.info_block', array('item' => $this->item, 'params' => $params, 'position' => 'above')); ?>
  78      <?php endif; ?>
  79      <?php if ($info == 0 && $params->get('show_tags', 1) && !empty($this->item->tags->itemTags)) : ?>
  80          <?php echo LayoutHelper::render('joomla.content.tags', $this->item->tags->itemTags); ?>
  81      <?php endif; ?>
  82  
  83      <?php // Content is generated by content plugin event "onContentBeforeDisplay" ?>
  84      <?php echo $this->item->event->beforeDisplayContent; ?>
  85  
  86      <?php echo $this->item->introtext; ?>
  87  
  88      <?php if ($info == 1 || $info == 2) : ?>
  89          <?php if ($useDefList) : ?>
  90              <?php echo LayoutHelper::render('joomla.content.info_block', array('item' => $this->item, 'params' => $params, 'position' => 'below')); ?>
  91          <?php endif; ?>
  92          <?php if ($params->get('show_tags', 1) && !empty($this->item->tags->itemTags)) : ?>
  93              <?php echo LayoutHelper::render('joomla.content.tags', $this->item->tags->itemTags); ?>
  94          <?php endif; ?>
  95      <?php endif; ?>
  96  
  97      <?php if ($params->get('show_readmore') && $this->item->readmore) :
  98          if ($params->get('access-view')) :
  99              $link = Route::_(RouteHelper::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));
 100          else :
 101              $menu = Factory::getApplication()->getMenu();
 102              $active = $menu->getActive();
 103              $itemId = $active->id;
 104              $link = new Uri(Route::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false));
 105              $link->setVar('return', base64_encode(RouteHelper::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language)));
 106          endif; ?>
 107  
 108          <?php echo LayoutHelper::render('joomla.content.readmore', array('item' => $this->item, 'params' => $params, 'link' => $link)); ?>
 109  
 110      <?php endif; ?>
 111  
 112      <?php if ($isUnpublished) : ?>
 113          </div>
 114      <?php endif; ?>
 115  
 116  </div>
 117  
 118  <?php // Content is generated by content plugin event "onContentAfterDisplay" ?>
 119  <?php echo $this->item->event->afterDisplayContent; ?>


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