Problem/Motivation
Other modules which integrate with Webform could leverage Webform Share if hooks were provided at appropriate places in the process. The existing import can override the existing 'webform' property of the node object, but that may not be sufficient for modules which require other database tables to be updated for correct functioning. Adding a couple of hooks would eliminate that problem.
As you can probably guess, I'm working on a module that would benefit from such hooks. ;)
Proposed resolution
I suggest adding two hooks:
hook_webform_share_import(&$node, $keep_existing_components)hook_webform_share_export_alter(&$node)
The hook_webform_share_export_alter() is probably of lesser importance, as other modules can get around it by hooks in webform itself, but that's much harder to do on import.
Remaining tasks
- Implement the hooks in the code
- Create a webform_share.api.php file to document the hooks
I would be happy to work up a patch to implement these hooks, if there is any interest in implementing them into the code.
User interface changes
None
API changes
Addition of the hooks specified above
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | webform_share-2306565-5-import-export-alters.patch | 4.04 KB | dbcollies |
| #2 | webform_share-2306565-2-import-export-alters.patch | 1.76 KB | alan d. |
Comments
Comment #1
dbcollies commentedComment #2
alan d. commentedSomething like this?
Comment #3
dbcollies commentedI actually got around this requirement in my module by hooking node load and save. So feel free to change this to "Closed (won't fix)" if you don't think it worth including.
However, if you still want to include this functionality, then I would suggest that the import hook be altered to include the flags set by the user. There should also be a webform_share.api.php file documenting the hooks. I'd be happy to submit an updated patch if you want.
Comment #4
alan d. commentedSure, happy to commit if supplied.
Comment #5
dbcollies commentedHere's my attempt at a new patch to do what I was describing.
Comment #6
alan d. commentedYou do not need the pointer reference (&) when passing an object, otherwise all good.