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.
In Drupal 6 this was quite easy but with Rules-7.x some things have changed.
Idea by fago:
Wrap your data, inherit from EntityMetadataWrapper and create a custom wrapper class containing your custom save() method. It could be built very similar to the EntityDrupalWrapper (see entity API).
If we have that in place ... we just need to fix RulesState::isSavable() accordingly, e.g. we could introduce an interface or even provide your custom wrapper with Rules ...
This is the way to go! Yeah!
Comments
Comment #1
wizonesolutionsIs this still in the plans? It seems like an event for "before a Webform submission is saved" is needed. If there is no explicit hook, you could just add a
#submit
handler to the relevant forms. Not sure how you'd react programmatically — maybe by implementing a query alter hook.It'd be great to use Webform Rules as an enhanced version of the Conditionals tab in 4.x.
Comment #2
bisonbleu CreditAttribution: bisonbleu commentedAnother way to achieve this without Rules is to create a custom module in which you implement
hook_webform_submission_presave()
.Here is the example from /sites/all/modules/webform/webform.api.php: