Zend certified PHP/Magento developer

Custom email directive as per Magento 2.4 docs example not working

While upgrading our email templates to comply with the security changes introduced in Magento 2.4.3-p2, I’m having trouble creating a custom directive as per the Magento docs.

I tried to use the example from the docs (with modifications to the namespace, of course), but it doesn’t seem to work. When I use {{custom_directive}} inside the email template, that’s what I later see in the email, so it doesn’t work as expected. I tried this both on Magento v 2.4.3-p2 and also on a clean installation of 2.4.2. Neither is working for me.

Did anyone of you get this example from the Docs working, or successfully implemented your own version?