first commit
This commit is contained in:
58
templates/cassiopeia/html/layouts/chromes/card.php
Normal file
58
templates/cassiopeia/html/layouts/chromes/card.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage Templates.cassiopeia
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
$module = $displayData['module'];
|
||||
$params = $displayData['params'];
|
||||
$attribs = $displayData['attribs'];
|
||||
|
||||
if ($module->content === null || $module->content === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$moduleTag = $params->get('module_tag', 'div');
|
||||
$moduleAttribs = [];
|
||||
$moduleAttribs['class'] = $module->position . ' card ' . htmlspecialchars($params->get('moduleclass_sfx', ''), ENT_QUOTES, 'UTF-8');
|
||||
$headerTag = htmlspecialchars($params->get('header_tag', 'h3'), ENT_QUOTES, 'UTF-8');
|
||||
$headerClass = htmlspecialchars($params->get('header_class', ''), ENT_QUOTES, 'UTF-8');
|
||||
$headerAttribs = [];
|
||||
$headerAttribs['class'] = $headerClass;
|
||||
|
||||
// Only output a header class if it is not card-title
|
||||
if ($headerClass !== 'card-title') :
|
||||
$headerAttribs['class'] = 'card-header ' . $headerClass;
|
||||
endif;
|
||||
|
||||
// Only add aria if the moduleTag is not a div
|
||||
if ($moduleTag !== 'div') {
|
||||
if ($module->showtitle) :
|
||||
$moduleAttribs['aria-labelledby'] = 'mod-' . $module->id;
|
||||
$headerAttribs['id'] = 'mod-' . $module->id;
|
||||
else :
|
||||
$moduleAttribs['aria-label'] = htmlspecialchars($module->title, ENT_QUOTES, 'UTF-8');
|
||||
endif;
|
||||
}
|
||||
|
||||
$header = '<' . $headerTag . ' ' . ArrayHelper::toString($headerAttribs) . '>' . $module->title . '</' . $headerTag . '>';
|
||||
?>
|
||||
<<?php echo $moduleTag; ?> <?php echo ArrayHelper::toString($moduleAttribs); ?>>
|
||||
<?php if ($module->showtitle && $headerClass !== 'card-title') : ?>
|
||||
<?php echo $header; ?>
|
||||
<?php endif; ?>
|
||||
<div class="card-body">
|
||||
<?php if ($module->showtitle && $headerClass === 'card-title') : ?>
|
||||
<?php echo $header; ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $module->content; ?>
|
||||
</div>
|
||||
</<?php echo $moduleTag; ?>>
|
||||
52
templates/cassiopeia/html/layouts/chromes/noCard.php
Normal file
52
templates/cassiopeia/html/layouts/chromes/noCard.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage Templates.cassiopeia
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
$module = $displayData['module'];
|
||||
$params = $displayData['params'];
|
||||
$attribs = $displayData['attribs'];
|
||||
|
||||
if ($module->content === null || $module->content === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$moduleTag = $params->get('module_tag', 'div');
|
||||
$moduleAttribs = [];
|
||||
$moduleAttribs['class'] = $module->position . ' no-card ' . htmlspecialchars($params->get('moduleclass_sfx', ''), ENT_QUOTES, 'UTF-8');
|
||||
$headerTag = htmlspecialchars($params->get('header_tag', 'h3'), ENT_QUOTES, 'UTF-8');
|
||||
$headerClass = htmlspecialchars($params->get('header_class', ''), ENT_QUOTES, 'UTF-8');
|
||||
$headerAttribs = [];
|
||||
|
||||
// Only output a header class if one is set
|
||||
if ($headerClass !== '') {
|
||||
$headerAttribs['class'] = $headerClass;
|
||||
}
|
||||
|
||||
// Only add aria if the moduleTag is not a div
|
||||
if ($moduleTag !== 'div') {
|
||||
if ($module->showtitle) :
|
||||
$moduleAttribs['aria-labelledby'] = 'mod-' . $module->id;
|
||||
$headerAttribs['id'] = 'mod-' . $module->id;
|
||||
else :
|
||||
$moduleAttribs['aria-label'] = htmlspecialchars($module->title, ENT_QUOTES, 'UTF-8');
|
||||
endif;
|
||||
}
|
||||
|
||||
$header = '<' . $headerTag . ' ' . ArrayHelper::toString($headerAttribs) . '>' . $module->title . '</' . $headerTag . '>';
|
||||
?>
|
||||
<<?php echo $moduleTag; ?> <?php echo ArrayHelper::toString($moduleAttribs); ?>>
|
||||
<?php if ($module->showtitle) : ?>
|
||||
<?php echo $header; ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $module->content; ?>
|
||||
</<?php echo $moduleTag; ?>>
|
||||
72
templates/cassiopeia/html/layouts/joomla/icon/iconclass.php
Normal file
72
templates/cassiopeia/html/layouts/joomla/icon/iconclass.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage Layout
|
||||
*
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
// Convert icomoon to fa
|
||||
$icon = $displayData['icon'];
|
||||
|
||||
// Get fixed width icon or not
|
||||
$iconFixed = $displayData['fixed'] ?? null;
|
||||
|
||||
// Set default prefix to be fontawesome
|
||||
$iconPrefix = $displayData['prefix'] ?? 'icon-';
|
||||
|
||||
// Get other classNames if set, like icon-white, text-danger
|
||||
$iconSuffix = $displayData['suffix'] ?? null;
|
||||
|
||||
// Get other attributes besides classNames
|
||||
$tabindex = $displayData['tabindex'] ?? null;
|
||||
$title = $displayData['title'] ?? null;
|
||||
|
||||
// Default output in <span>. ClassNames if set to false
|
||||
$html = $displayData['html'] ?? true;
|
||||
|
||||
// Replace double set icon-icon-
|
||||
// @todo: Joomla should be cleaned so this replacement is not needed.
|
||||
$icon = str_replace('icon-icon-', 'icon-', $icon);
|
||||
|
||||
switch ($icon) {
|
||||
case (strpos($icon, 'icon-') !== false):
|
||||
$iconPrefix = $displayData['prefix'] ?? null;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ($iconFixed) {
|
||||
$iconFixed = 'icon-fw';
|
||||
}
|
||||
|
||||
// Just render icon as className
|
||||
$icon = trim(implode(' ', [$iconPrefix . $icon, $iconFixed, $iconSuffix]));
|
||||
|
||||
// Convert icon to html output when HTML !== false
|
||||
if ($html !== false) {
|
||||
$iconAttribs = [
|
||||
'class' => $icon,
|
||||
'aria-hidden' => "true"
|
||||
];
|
||||
|
||||
if ($tabindex) {
|
||||
$iconAttribs['tabindex'] = $tabindex;
|
||||
}
|
||||
|
||||
if ($title) {
|
||||
$iconAttribs['title'] = $title;
|
||||
}
|
||||
|
||||
$icon = '<span ' . ArrayHelper::toString($iconAttribs) . '></span>';
|
||||
}
|
||||
|
||||
echo $icon;
|
||||
Reference in New Issue
Block a user