I am working with Joomla 4 and facing an issue where each module I include gets automatically wrapped in a tag with a "custom" class, like so:
<div id="mod-custom153" class="mod-custom custom">
Module content
</div>
<jdoc:include type="modules" name="top" style="raw" />
My Solution:
I am using a module layout called raw.php in my
templates\template_name\html\layouts\chromes\raw.php
<?php
defined('_JEXEC') or die;
// Get the module
$module = $displayData['module'];
// If the module doesn't have any content, skip (return)
if ($module->content === null || $module->content === '') {
return;
}
// Output the module content without the surrounding <div>
$pattern = '/<div[^>]*>(.*)<\/div>/s';
preg_match($pattern, $module->content, $matches);
if (!empty($matches)) {
echo $matches[1];
}
?>
it seems to work.
But is there a way to automatically prevent Joomla 4 from wrapping modules in tags?
Any guidance would be greatly appreciated.