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'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?
Comment | File | Size | Author |
---|---|---|---|
#2 | webform-add_drupal_static_to_webform_filter_values-1448448.patch | 510 bytes | iSampo |
Comments
Comment #1
quicksketchIn 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.
Comment #2
iSampo CreditAttribution: iSampo commentedHi!
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!
Comment #3
quicksketchThanks, great idea. I'll apply this next pass through the queue.
Comment #4
quicksketchThanks, committed to 7.x-3.x branch. This isn't necessary in the 4.x branch because it uses the D7 token system.
Comment #5.0
(not verified) CreditAttribution: commentedReason->problem