Mautic TWIG Advanced Templates Bundle

Debian stable
Mautic 4.4.5
PHP 7.4.33
Newest from Debian stable

Updating/Installing Errors
I am (delete as applicable): Installing TWIG Plugin MauticAdvancedTemplatesBundle

These errors are showing in the installer :
MauticAdvancedTemplatesBundle error php

These errors are showing in the Mautic log :
none
Your problem
My problem is :

After copying the plugin files into the plugin directory, and deleting the cache, I can’t access mautic any more.

Steps I have tried to fix the problem :

What does it show in log files under mautic-root/var/logs

I did not find any error regarding the problem.
The error popped up while doing a php bin/console cache:clear

In order to access my Mautic, I deleted the plugin, and after the php bin/console cache:clear command I could access my Mautic again.

This plugin?

ItS not M4 compatible.

Yes, this one. Many thanks for your answer.
Then what can I do? Is there another possibility of doing an “if then else” conditional content handling?

This plugin is golden.

Many thanks. Is there a promotion code? :slight_smile:

Kind regards

Christian

1 Like

No, but if you buy the plugin, you help mautic’s one of most active coder. (I have no affiliation, this plugin is my very honest recommendation.)

Many thanks. That’s fair enough!

Have a great day!

Well, I bought it, I installed it and I wrote the first TWIG template.

The test worked as well.

What does not work is the integration into an email template with:

{twigtemplate=1}

It just does not show the contend.

Hum

Did it work for you when you tested in the twig template area?

BTW - you need a real send, cause test send doesn’t render

Yes, in the test area it worked!

As you mentioned, it needs a real send.

Many thanks!

We have forked the plugin and patched it for Mautic v4. We also add some new features and some bugfixes (error handling for example and some problems with the rendering).

You find it here:

New Features:

  • Mautic v4
  • The plugin now integrates also into pages and dynamic content and you can also use the last form submits of the user as tokens (syntax {{ form.. }} )

Example:

{% TWIG_BLOCK %}
{{ form.12.email }} 
{% END_TWIG_BLOCK %}

would echo the email field of the last form submit from form 12 of the lead

P.S: I’m sorry I have not found the time to document the features more and to make a pull request in the original plugin. But I wanted to take the chance and help :slight_smile:

Greetings
Sebastian

4 Likes

Hello, is any of the plugins working on version 6? This should be native feature of mautic :slight_smile:

2 Likes

Testing mautic 7, also hoping for some doc on how to enable twig using free plugin

I had the same need and mautic and teh twig plugin does not seem to be compatible with mautic 6. I created a plugin GitHub - ryonwhyte/MauticTwigEnhancements

In case anyone comes across this and has the same issues you can test this out. Works great for me on mautic 6.

1 Like

Hello Ryon

Such a great job you did! Many, many thanks for your work!
I wanted to test it straight away, unpacked and copied the directory into the plugins folder, refreshed the installed plugins, but no Mautic Twig Enhancements avialable.
I’m using Mautic 6.0.7 and PHP 8.2..

Kind regards

Christian

1 Like

Hi @taxi

I had an issue like that.

  1. Ensure the folder has the correct name “MauticTwigEnhancementsBundle
  2. I kept running into a permission issue. The plugin folder was owned by root as I cloned the repo as root user. Then mautic could not access it so ensure the folder have the correct permission.

Clear the cache after install.

I also had a case where the plugin was active but did not show in the UI. I then realize my log file was owned by root and when activating the plugin there was a warning that tried to write to the log and failed. So the plugin was active and can be used but was not visible in the UI. This was caused my cron jobs running as root.

Try this command (I am running in docker you may need to adjust)

cd /var/www/html   # or wherever Mautic is installed

php bin/console debug:container | grep -i twig

php bin/console debug:event-dispatcher EmailEvents::EMAIL_ON_SEND

Or if you need to run as the web server user:

sudo -u www-data php bin/console debug:container | grep -i twig

If you see entries like

mautic.twig_enhancements.twig_processor

mautic.twig_enhancements.email_subscriber

Then its active.

Hi Ryon,

Many thanks for your quick help.

I tried the steps you suggested. No success yet.

php bin/console mautic:plugins:reload comes up with the following error:

In PluginUpdateEvent.php line 17:

Mautic\PluginBundle\Event\PluginUpdateEvent::__construct(): Argument #3 ($metadata) must be of typ
e array, null given, called in /var/www/clients/client1/web134/web/mautic/docroot/app/bundles/Plug
inBundle/Helper/ReloadHelper.php on line 83

mautic:plugins:reload