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.
Rather than dropping .inc files into webform/components , with the attached patch you can create a module with its own components subdirectory e.g. mymodule, containing the implementation of the hook_load_webform_components
hook:
function mymodule_load_webform_components() {
return webform_load_webform_components('mymodule');
}
The default behaviour is still the same, so it could go into 5.x-2.x .
Comment | File | Size | Author |
---|---|---|---|
#13 | webform_component_api3.patch | 70.46 KB | quicksketch |
#11 | webform_2.7_extended_components.patch_rehunk.txt | 2.43 KB | jp.stacey |
#10 | webform_2.7_extended_components.patch | 2.19 KB | bart.vandendriessche |
webform_extended_components.patch.txt | 2.43 KB | jp.stacey |
Comments
Comment #1
quicksketchNice! This looks great and I would've done it exactly the same. It's a bit unfortunate this will effectively "lock" the APIs though, but it seems like they're already pretty well cemented with users creating or using custom .inc files anyway. The Webform API has intentionally been closed because it makes it possible to make improvements internally without breaking dependent modules. So I'm fine with this patch, despite it's repercussions. We'll just need to really lock all APIs until a new 3.x version of the module is released.
Comment #2
jp.stacey CreditAttribution: jp.stacey commentedGlad you like it :) As you say, I think the API has been effectively locked by users anyway, and at least this means that people can stash their component files elsewhere and be able to upgrade webform with minimal fuss. It doesn't in itself make any new promises about the API changing...!
How do we move this code forward, to being included in the 2.x branch? I'm a newbie to the process generally.
Comment #3
Chris CharltonCommit it! :D
Comment #4
Chris CharltonSince 3.x is proposed to be built with Form Builder in the front, can we lock the api for 2.x and get this rolled into dev? I'm really interested in helping release my nodes & ajax select components.
Comment #5
quicksketchThis patch needs to be rerolled for Drupal 6. It applies fine to Drupal 5. I plan on releasing 2.4 shortly as a bug fixing release. Lastly I want to commit #132279: Pager results page before "officially" locking the API. So we can expect this in 2.5.
Comment #6
ngmaloney CreditAttribution: ngmaloney commentedHi All!
This patch is really, really useful. Nice job! Is there a 5.x (dev) release available with it already applied? If not, is there anything I can do to help out?
I developed a module that adds 2 new components that I ALWAYS find myself needing; pre-populated state and country select boxes. It works great but is dependent on the webform_load_webform_components hook. I'll gladly release my module but would like to wait until it isn't dependent on a webforms patch.
Again, thanks to everyone for all their great work on this module!
Comment #7
pan0s CreditAttribution: pan0s commentedIs the supplied patch above supposed to work with 2.6 version?i cant seem to apply the patch ...
Comment #8
jp.stacey CreditAttribution: jp.stacey commentedHi,
I was hoping to upgrade to 2.6 but it's not clear if my patch above has been applied yet or not. From @pan0s' comment, apparently not.
@quicksketch, has the patch been applied prior to 2.6? I need to upgrade because of a bug in webform_get_submissions (no ordering means
if ($row->sid != $previous)
sometimes kills my data)J-P
Comment #9
quicksketchThis patch has not been applied to any version yet, hence why this issue is marked "needs work" and not "fixed". I've stopped supporting Drupal 5 since my last comment, and this will no longer be applied to that version even if it is made ready. All new features are now going into the 3.x branch for Drupal 6 only.
Comment #10
bart.vandendriessche CreditAttribution: bart.vandendriessche commentedIf anyone still cares, I manually applied these changes to the 2.7 version and created a new patch.
Comment #11
jp.stacey CreditAttribution: jp.stacey commented@bart.vandendriessche thanks for that. The patch looks like it was exactly the same between versions, but the hunks have moved considerably in line number so patch would fail. I've attached a rewrite myself for 2.7 .
This is a really straightforward change, that people here have tested and want. It's a real shame that it can't at least go into the D5 version of the module so that we don't have to re-patch when security fixes are rolled out.
Comment #12
omerida CreditAttribution: omerida commentedThe patch in #10 applied for me, but #11 failed.
Comment #13
quicksketchWell this never happened due to a lack of a patch that worked in both D5 and D6. Development on 2.x has stopped, so it's unlikely this will happen in the 2.x version. I've extensively reworked the component system so that it is pluggable in this new approach for 3.x. It also cleans up a few function names and changes our definitions.
Summary of changes:
Overall the whole system is much more efficient, since we only load component.inc files as needed instead of blinding loading all components when we only need one of them. Our APIs are still fluid in the 3.x version and I expect a few more changes here and there. Specifically we'll probably change the way that e-mails are done, since we can re-use the e-mail formatting for #181077: Printable page for webform submissions also.
I've committed this patch to help continue the improvements to the 3.x version.
Comment #14
quicksketchComment #16
jp.stacey CreditAttribution: jp.stacey commented@quicksketch - I took my eye off this once it closed, as we'd moved onto different work that didn't involve heavy webform use, so I never got back to you on this to thank you.
I'm currently converting our hacked 2.x webform to 3.x-beta6 in preparation for an upcoming new site, and with a few tweaks the 3.x API is all working brilliantly. In fact, it all makes a lot more sense than when I was just hacking out existing *.inc files and gutting them. While I appreciate it's all still a beta, it's nonetheless currently doing exactly what we want it to with our legacy collection of custom fields.
Thanks again!