<?php
/* Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
 *
 * This file is part of a Moko Consulting project.
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 * FILE INFORMATION
 * DEFGROUP: MokoOnyx.Layout
 * INGROUP: MokoOnyx
 * REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoOnyx
 * PATH: /html/layouts/joomla/module/card.php
 * VERSION: 01.00.07
 * BRIEF: Custom card module chrome — renders module titles for all modules
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;

$module  = $displayData['module'];
$params  = $displayData['params'];
$attribs = $displayData['attribs'];

$moduleTag   = htmlspecialchars($params->get('module_tag', 'div'), 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');
$bootstrapSize = (int) $params->get('bootstrap_size', 0);
$moduleClass = htmlspecialchars($attribs['moduleclass_sfx'] ?? '', ENT_QUOTES, 'UTF-8');

$moduleId = 'module-' . $module->id;

if ($module->content === '' && $module->content === null) {
	return;
}

$cardClass = 'card' . ($moduleClass ? ' ' . $moduleClass : '');
?>
<<?php echo $moduleTag; ?> id="<?php echo $moduleId; ?>" class="<?php echo $cardClass; ?>">
	<?php if ((bool) $module->showtitle) : ?>
		<div class="card-header">
			<<?php echo $headerTag; ?> class="card-title<?php echo $headerClass ? ' ' . $headerClass : ''; ?>"><?php echo $module->title; ?></<?php echo $headerTag; ?>>
		</div>
	<?php endif; ?>
	<div class="card-body">
		<?php echo $module->content; ?>
	</div>
</<?php echo $moduleTag; ?>>
