netgen / NetgenInformationCollectionBundle

Information collection alike feature for eZ Publish 5/eZ Platform
https://netgen.io
GNU General Public License v2.0
19 stars 8 forks source link

Semantic configuration for email templates #7

Closed emodric closed 7 years ago

emodric commented 7 years ago

It would be great to have a semantic configuration for email templates, so we don't have to override the config by using container params.

As an alternative, consider using eZ Publish view layer, so you can render the template simply by rendering a sub controller, as was done in eZ Publish legacy with collectedinfo and collectedinfomail view types.

MarioBlazek commented 7 years ago

Added new semantic configuration for templates, actions and default fallback values. So example config looks like this:

netgen_information_collection:
    system:
        default:
            templates:
                default: "AcmeBundle:email:default.html.twig"
                content_types:
                    content_type_1: "AcmeBundle:email:content_type_1.html.twig"
                    content_type_2: "AcmeBundle:email:content_type_2.html.twig"
            fallback_values:
                sender: 'sender@example.com'
                recipient: 'recipient@example.com'
                subject: 'Email from Acme website'
            actions:
                default:
                    - email
                    - database
                content_types:
                    content_type_1:
                        - some_custom_action
                    content_type_2:
                        - some_custom_action
emodric commented 7 years ago

I propose a slight reorganization of settings to be something like this (since all of it is related to email action, after all):

netgen_information_collection:
    system:
        default:
            action_config:
                email:
                    templates:
                        default: ...
                        content_types:
                            type_1: ...
                    default_variables:
                        sender: ...
                        recipient: ...
                        subject: ...
MarioBlazek commented 7 years ago

Implemented as described above.