Posted by dpantele on February 21, 2012 at 6:21pm
3 followers
| Project: | Webform |
| Version: | 7.x-3.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
I'm trying to send email for more than one submission during a page load. However, _webform_filter_values caches all tokens in static variable. So, all variables except %email_values has correct values only for the first submission.
Also there is the a bug in Webform2PDF because of this problem.
Can we add $reset parameter to _webform_filter_values?
Comments
#1
In Drupal 7, the preferred approach is to use a drupal_static() call, which will allow you to reset a variable without adding an additional parameter to the function. See http://api.drupal.org/drupal_static. If you're interested in writing patch I'd be happy to review it.
I'm moving this to minor because it doesn't affect normal functionality of the module.
#2
Hi!
I'm working on Webform Mass Email and also bumped on this when trying to use the _webform_filter_values function.
Here's a patch for Webform that converts the replacement values to use drupal_static. I don't really know where other places _webform_filter_values() is used, so I couldn't test that much. To me this approach worked and I was able to reset the variable using drupal_static_reset('_webform_filter_values'). Is this the right way? Thanks!
#3
Thanks, great idea. I'll apply this next pass through the queue.