Mautic Community Forums

Mautic 3: plugin template only one asset loading

Hello I have a really weird issue with my plugin.

I am creating a new plugin to add new slot types and I am using Mautic 3.

Depending where I include my assets, Mautic is doing different stuff.

For example, only the first included asset will be loaded. If I put the “includeStylesheet” first, I will have the styles loading but not the javascript, but if I put “includeScript” first, only the javascript will be loaded.

Moreover if I put them both at the top of the template, then nothing is working and it is printing the HTML on the Slot type icon.

There is my current template:

<div class="img-side">
<img src="<?php echo $view['assets']->getUrl('themes/blank.png', null, null, true); ?>" alt="An image" />
<span><?php echo $view['translator']->trans('mautic.core.slot.label.text.insert'); ?></span>
</div>
<?php
echo $view['assets']->includeScript('plugins/MauticMellengerSlotTypesBundle/Assets/js/builder.js');
echo $view['assets']->includeStylesheet('plugins/MauticMellengerSlotTypesBundle/Assets/css/styles.css');
?>
<div style="clear:both"></div>

I appreciate if anyone has information how Mautic is handling templates because those behaviors don’t make any sense to me. I followed the documentation which is basically doing the same as me I think:
https://developer.mautic.org/#asset-helper

Thank you to anybody reading this.