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.. }} )
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
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..
Ensure the folder has the correct name “MauticTwigEnhancementsBundle
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
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