getgrav / grav-plugin-email

Grav Email Plugin
http://getgrav.org
MIT License
37 stars 29 forks source link

Ability to change 'process.email.to' dynamically per single page #61

Closed vladzhigulsky closed 7 years ago

vladzhigulsky commented 7 years ago

I have a page collection of events. Each single event page has a contact form. Visually the contact form itself is always the same and defined in the events parent page header.

Then it's displayed in the single pages via include: {% include "forms/events/form.html.twig" with { form: forms('event-contact-form') } %}

The only thing that needs to be dynamic per event is process.email.to because the contact form data will be send to different people depending on the type of the event. There is a field in the event single template which allows the editors to specify email address where it needs to be sent to. Therefore, setting process.email.to to config.plugins.email.to isn't going to work as it's always static.

What is the best way to achieve this?

vladzhigulsky commented 7 years ago

Worked out the solution for this and created a plugin with custom processing as per below: add your own custom processing to a form