From cfd5b83c483d6a0ca7a6c8bacc5e845cb4f83ecf Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Sat, 22 Nov 2014 17:56:54 -0800 Subject: [PATCH] Supplying token source to notification. --- .../Handlers/FormSubmissionCoordinator.cs | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Handlers/FormSubmissionCoordinator.cs b/src/Orchard.Web/Modules/Orchard.DynamicForms/Handlers/FormSubmissionCoordinator.cs index f320206ee..920672473 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Handlers/FormSubmissionCoordinator.cs +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Handlers/FormSubmissionCoordinator.cs @@ -29,6 +29,15 @@ namespace Orchard.DynamicForms.Handlers { var formName = form.Name; var values = context.Values; var formService = context.FormService; + var formValuesDictionary = values.ToTokenDictionary(); + var formTokenContext = new FormSubmissionTokenContext { + Form = form, + ModelState = context.ModelState, + PostedValues = values + }; + var tokensData = new Dictionary(formValuesDictionary) { + {"FormSubmission", formTokenContext}, + }; // Store the submission. if (form.StoreSubmission == true) { @@ -43,18 +52,10 @@ namespace Orchard.DynamicForms.Handlers { // Notifiy. if (!String.IsNullOrWhiteSpace(form.Notification)) - _notifier.Information(T(_tokenizer.Replace(T(form.Notification).Text, null))); + _notifier.Information(T(_tokenizer.Replace(T(form.Notification).Text, tokensData))); // Trigger workflow event. - var formValuesDictionary = values.ToTokenDictionary(); - var formTokenContext = new FormSubmissionTokenContext { - Form = form, - ModelState = context.ModelState, - PostedValues = values - }; - _workflowManager.TriggerEvent(DynamicFormSubmittedActivity.EventName, contentItem, () => new Dictionary(formValuesDictionary) { - {"FormSubmission", formTokenContext}, - }); + _workflowManager.TriggerEvent(DynamicFormSubmittedActivity.EventName, contentItem, () => tokensData); } } } \ No newline at end of file