In mollom_form_alter, mollom attempts to increase buttons' weights of the forms which the mollom form is attached to.
The code ignores webform submit form elements. (I do use webform's latest release: 6.x-3.0-beta5.)
If in function mollom_form_alter I replace
if (isset($form[$key]['#type']) && in_array($form[$key]['#type'], array('submit', 'button', 'image_button'))) {
by
if (isset($form[$key]['#type']) && in_array($form[$key]['#type'], array('submit', 'button', 'image_button')) ||
isset($form[$key]['submit']['#type']) && $form[$key]['submit']['#type'] == 'submit') {
the webform submit form elements are taken into account.
I'm not sure this is generic enough.
I do know this also does not seem to work with custom forms that have an extra parent key in the form array structure.
F.e. weight of element $form['mycustomform']['submit'] is not modified. Weight of $form['submit'] is.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | mollom-HEAD.form-actions.9.patch | 1.04 KB | sun |
| #9 | mollom-DRUPAL-6--1.form-actions.9.patch | 2.68 KB | sun |
| #8 | mollom-DRUPAL-6--1.form-actions.8.patch | 2.64 KB | sun |
| #5 | mollom-DRUPAL-6--1.form-actions.5.patch | 2.52 KB | sun |
| #4 | mollom-HEAD.form-actions.4.patch | 971 bytes | sun |
Comments
Comment #1
sunI wonder whether Webform shouldn't rather assign a (better) #weight value for its buttons instead?
Comment #2
dries commentedI'd "yes" but I've pinged quicksketch and pointed him to this issue.
Comment #3
quicksketchSetting a weight for the buttons would be a good idea. Hopefully that would more correctly fix #790620: Captcha placed below submit button also.
Comment #4
sunI've re-opened #790620: Captcha placed below submit button and provided a first patch against Webform HEAD.
For Mollom HEAD, we can simplify the code a bit.
Let's tackle D6 afterwards.
Comment #5
sunAttached patch should fix the issue for D6. I'm already using a similar code in http://drupal.org/project/button_style for D6, which actually was the prototype for D7's #type 'actions'.
Comment #6
dries commentedCommitted to CVS HEAD. Thanks.
Comment #7
dries commentedOops, still need to review #5.
Comment #8
sunSlightly improved the comments.
Comment #9
sunOn a third look, the code in HEAD can be totally compressed into a single line now. :)
For D6, I was not entirely happy with the detection of 'actions' yet. We should expect the parent key, but no actions][#type. If it has a #type, then it's not a button container, as you'd use #prefix and #suffix under D6.
Comment #10
dries commentedCommitted the patch for CVS HEAD. Still looking at the patch for D6.
Comment #11
sun#9: mollom-DRUPAL-6--1.form-actions.9.patch queued for re-testing.
Comment #12
sun#9: mollom-DRUPAL-6--1.form-actions.9.patch queued for re-testing.
Comment #13
sunComment #14
dries commentedCommitted to DRUPAL-6--1. Thanks.