PHP Joomla! 6 Joomla! 5 Joomla! 4 Template Intermediate

Create a Custom Module Chrome in html/layouts/chromes/

Defines a reusable Joomla 4, 5 and 6 module chrome layout replacing legacy html/modules.php functions.

Updated on 24 November 2026 36 copies 141 views
templates/seu_template/html/layouts/chromes/cardClean.php
<?php

declare(strict_types=1);

\defined('_JEXEC') or die;

$module  = $displayData['module'];
$params  = $displayData['params'];
$content = trim((string) $module->content);

if ($content === '') {
    return;
}

$moduleTag = htmlspecialchars((string) $params->get('module_tag', 'div'), ENT_QUOTES, 'UTF-8');
$headerTag = htmlspecialchars((string) $params->get('header_tag', 'h3'), ENT_QUOTES, 'UTF-8');
$sfx       = htmlspecialchars((string) $params->get('moduleclass_sfx', ''), ENT_QUOTES, 'UTF-8');
?>
<<?php echo $moduleTag; ?> class="pm-module-box <?php echo $sfx; ?>">
    <?php if ((bool) $module->showtitle) : ?>
        <<?php echo $headerTag; ?> class="pm-module-box__title">
            <?php echo htmlspecialchars((string) $module->title, ENT_QUOTES, 'UTF-8'); ?>
        </<?php echo $headerTag; ?>>
    <?php endif; ?>
    <div class="pm-module-box__body"><?php echo $content; ?></div>
</<?php echo $moduleTag; ?>>
Use in your template with <jdoc:include type="modules" name="sidebar" style="cardClean" />.

Technical explanation and best practices

In Joomla 4, 5 and 6, each custom module style (style="cardClean") is a dedicated layout file inside templates/<template>/html/layouts/chromes/ receiving $displayData.

Direct Engineering

Have a Joomla project or technical challenge in mind?

From architectural diagnosis to production deployment, directly with the engineer.