Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I need to be able to automatically create a default email handler upon creation of each webform with the Email To Address being the email address of the current user creating the form.
All other email handler settings can use the default values set in the main email / handler settings section.
How would I hook into and create an email handler upon web form creation using this information?
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedUse hook_webform_create() and call \Drupal\webform\Entity\Webform::addWebformHandler
Comment #3
danjordan CreditAttribution: danjordan commentedThanks for the direction. Created the hook which returns the entity, just not exactly sure how to call addWebformHandler from within the hook with the information it requires.
The webform is only saved to memory at this stage so not sure how to add the handler
Any help would be awesome.
Thanks
Comment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented@see https://www.drupal.org/docs/8/modules/webform/webform-cookbook/how-can-y...
Comment #5
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #6
danjordan CreditAttribution: danjordan commentedTested and works as expected. Thanks Jacob, your a legend.
Comment #7
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented