Currently our webform_config_form_submit() function is impossible to extend in any way. At the beginning of the function we node_load() a NID, then node_save() at the bottom of it. While this is great use of API functions, it's impossible to extend this submit handler to save any additional properties (such as if you wanted to make the node title changeable from this form, or add additional properties into the $node->webform array).
This patch does 3 related things:
- Instead of node_load() at the beginning of the submit function, the $node that is passed into the form builder function is just kept in $form['#node']. This matches other places where the node is usually edited or used, such as the node form or even on a Webform client form.
- The call to node_save() is moved into a separate submit handler, so modules can insert an additional submit handler before it is called.
- The submit button is changed to use a #type='actions' wrapper to match Drupal 7 conventions. (Maybe not super-related but has to do with the submit all the same).
Comment | File | Size | Author |
---|---|---|---|
webform_config_form_submit.patch | 1.97 KB | quicksketch | |
Comments
Comment #1
quicksketchChecked one more time and committed to both branches of the project.
Comment #3
alexverb CreditAttribution: alexverb commentedIs it possible for anyone to enlighten me how I can add additional properties through my own submit function? I've tried something in the lines of:
But I can't seem to retain the additional value through the new node_save() submit handler. What am I overlooking here?
Comment #4
quicksketchSee this handbook page: http://drupal.org/node/1291574