Closed totten closed 7 years ago
I would prefer core columns approach as well - also provides room for other possible template builders in future e.g - https://beefree.io/ (template_type = 'beefree').
With the core support would it be better to have code structured in a way that it also allows other possible template builders to inject / take control? Need not be perfect at this point, but can evolve as new template builders appear / integrated? And in doing so it could also template builders to use their own tables if needed?
And totally agree on the idea of getting rid of hash_key and local storage.
Yes, we'll need a way for the alternative template builders to inject themselves. Generally, expect two touch-points:
civicrm/a/#/mailing/123
), we need to use a different Angular screen (e.g. change ~crmMailing/EditMailingCtrl/2step.html
to ~crmMosaico/mosaico.html
). (I've been using some small/experimental patches for this locally, but it only work if all mailings have been designed via Mosaico. Will revise when we have the schema for template_type
.)uk.co.vedaconsulting.mosaico
should make the determination about when/how/whether to perform Smarty evaluation on the outgoing message.)Will report back when I have more details.
If you consider both traditional content (
body_html
) and newer Mosaico-based content (metadata + content + rendered HTML), and consider both the use-cases of templates and individual mailings, then we have four scenarios for storing things in the database:civicrm_msg_template
records withbody_html
)civicrm_mailing
records withbody_html
)civicrm_mosaico_msg_template
withtemplate
,metadata
,html
pluscivicrm_msg_template
)There's currently no data-storage for saving a Mosaico-style mailing in its canonical/pristine form (without additional records in
civicrm_msg_template
andcivicrm_mosaico_msg_template
and synchronization logic). As we simplify the workflows for Mosaico, we need some way to pristinely store a Mosaico-style mailing.I'm intending to work on this next week but wanted to verbalize some approaches first (partially for my own clarity - but also in case @deepak-srivastava or other folks see additional issues). The approaches are:
civicrm_mailing
template_type
(varchar), e.g.traditional
ormosaico
template_options
(longtext), e.g. JSON blob containing Mosaico'smetadata
anddata
andhtml
template_type
and open a proper editor.template_type
andtemplate_options
(e.g. supporting other formats like Twig or refining the Smarty options or fixing the way CiviMail's Smarty-integration breaks the Smarty cache).civicrm_mosaico_mailing
:id
(int)mailing_id
(int, FK tocivicrm_mailing
for 1:1 relation)template
,metadata
,html
(same ascivicrm_mosaico_msg_template
)civicrm_mosaico_msg_template
so that it can store Mosaico-style templates or mailings:civicrm_mosaico_template
and useentity_table
/entity_id
, e.g.id
entity_table
,entity_id
(e.g.civicrm_mailing,200
orcivicrm_msg_template,50
)template
,metadata
,html
(same ascivicrm_mosaico_msg_template
)civicrm_mosaico_template
with differententity_table
values.Personal preference is to define core columns because it addresses
(Tangential Observation: None of those options above discuss the
hash_key
. That field is part of Mosaico'slocalStorage
adapter, but they have recommendations which allow you to ignore thelocalStorage
andhash_key
stuff when you have your own storage mechanism. See also: https://github.com/voidlabs/mosaico/issues/73#issuecomment-198584809 IMHO, keeping thelocalStorage
/hash_key
makes it hard to think about the dataflow because client-state and server-state may not match.)