New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix errors when smarty is enabled in settings #252
Conversation
@totten looks fine to me. This is how we tackled it in v1. Or you got some other ideas? |
@totten Any thoughts on this - it looks like a straightforward bugfix and would be good in the main release |
Short answer: no, patch civicrm-core and/or flexmailer instead. Long answer, primary critique: One of the original observations leading to Flexmailer is that In the case of Mosaico ( To my eye, the error reported at the top indicates a problem with the "Find Mailings" UI (or other core UI). The resolution -- figure out why that screen is using Smarty. In the presence of Flexmailer/Mosaico, it shouldn't be using Smarty. it shouldn't be hard-coded to use the Long answer, tangential critique: Adding
I include the tangential critique in the interest of generally sharing perspective. However, I'm -1 on this approach because of the primary critique. Addressing that should fix the symptom for Mosaico users and also provide an architecture where we can incrementally get away from mistakes of the past. |
Thanks for the detailed review @totten
Mosaico templates adds a web version link("View in your browser") when it is set to show pre-header. It navigates to This page is set to public, hence there is no error displayed on this link. The Smarty error shows up when any core UI is loaded after mailing is viewed. Thought either we need to override this link and call |
Ahh, that smells like a good idea! This way we can use existing interfaces.
That sounds fine. Just thinking/digesting out loud a bit... it seems reasonable to either:
I initially thought to update |
okay, proceeded with (b) and created a PR at civicrm/org.civicrm.flexmailer#21. For (a), maybe, this part in core needs to be replaced by the similar API call. |
OK, I understand that Smarty logic can't be used with Mosaico, but not being able to use conditional text in emails is a real issue, and limits the use of Mosaico for us to a few basic PR emails. I've found some hints that Mosaico has a "low-level template language" (https://github.com/voidlabs/mosaico/wiki/Template-language), but with no usable documentation this is not a replacement for the (relatively) simple Smarty approach. Please has anyone got any hints about how to include text conditional on a CiviCRM field or token? |
@TomCrawshaw https://civicrm.org/blog/colemanw/create-your-own-tokens-for-fun-and-profit I'm hoping to get funding in 2021 to build a token creator atop Search Kit, which would make creating many complex tokens possible for end users. |
Smarty error is shown on viewing a mailing which includes css in html. This only gets triggered when
CIVICRM_MAIL_SMARTY
is enabled in settings. To reproduce -Issue raised in #233