[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/templates/cassiopeia/html/layouts/chromes/ -> card.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  Templates.cassiopeia
   6   *
   7   * @copyright   (C) 2020 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\Utilities\ArrayHelper;
  14  
  15  $module  = $displayData['module'];
  16  $params  = $displayData['params'];
  17  $attribs = $displayData['attribs'];
  18  
  19  if ($module->content === null || $module->content === '') {
  20      return;
  21  }
  22  
  23  $moduleTag              = $params->get('module_tag', 'div');
  24  $moduleAttribs          = [];
  25  $moduleAttribs['class'] = $module->position . ' card ' . htmlspecialchars($params->get('moduleclass_sfx', ''), ENT_QUOTES, 'UTF-8');
  26  $headerTag              = htmlspecialchars($params->get('header_tag', 'h3'), ENT_QUOTES, 'UTF-8');
  27  $headerClass            = htmlspecialchars($params->get('header_class', ''), ENT_QUOTES, 'UTF-8');
  28  $headerAttribs          = [];
  29  $headerAttribs['class'] = $headerClass;
  30  
  31  // Only output a header class if it is not card-title
  32  if ($headerClass !== 'card-title') :
  33      $headerAttribs['class'] = 'card-header ' . $headerClass;
  34  endif;
  35  
  36  // Only add aria if the moduleTag is not a div
  37  if ($moduleTag !== 'div') {
  38      if ($module->showtitle) :
  39          $moduleAttribs['aria-labelledby'] = 'mod-' . $module->id;
  40          $headerAttribs['id']              = 'mod-' . $module->id;
  41      else :
  42          $moduleAttribs['aria-label'] = $module->title;
  43      endif;
  44  }
  45  
  46  $header = '<' . $headerTag . ' ' . ArrayHelper::toString($headerAttribs) . '>' . $module->title . '</' . $headerTag . '>';
  47  ?>
  48  <<?php echo $moduleTag; ?> <?php echo ArrayHelper::toString($moduleAttribs); ?>>
  49      <?php if ($module->showtitle && $headerClass !== 'card-title') : ?>
  50          <?php echo $header; ?>
  51      <?php endif; ?>
  52      <div class="card-body">
  53          <?php if ($module->showtitle && $headerClass === 'card-title') : ?>
  54              <?php echo $header; ?>
  55          <?php endif; ?>
  56          <?php echo $module->content; ?>
  57      </div>
  58  </<?php echo $moduleTag; ?>>


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