Hello,
I had a problem using a simple modal. The popup image didn't show.
When I was under Astroid Template, I simply added JHtml::_('bootstrap.modal');
to the index.php file of the template and the modal worked.
But with T4, it didn't work. I tried to insert it in global Settings > custom code. It didn't work.
Then I created a mod_custom of T4 (In System > Site Template) and opened the default.php which is stored in /templates/t4_bs5_blank/html/mod_custom/default.php
I inserted JHtml::_('bootstrap.modal');
before the closing ?>
and it worked.
...
if ($params->get('backgroundimage'))
{
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->addInlineStyle('
#' . $modId . '{background-image: url("' . Uri::root(true) . '/' . HTMLHelper::_('cleanImageURL', $params->get('backgroundimage'))->url . '");}
', ['name' => $modId]);
}
JHtml::_('bootstrap.modal');
?>
The modal now opens normally.
My questions are :
Is it safe/proper to do so ?
Should I insert this code in another file ?
Thank you