Currently, confirm_form() says it outputs a confirmation form/returns a complete form for confirming an action.
This snagged me b/c I couldn't figure out why my modules suddenly broke that used a syntax like...
$output = drupal_get_form('confirm_form', ...);
This breaks b/c FAPI now passes in $form_state as the first argument to any form builder function, but confirm_form() doesn't accommodate this. Instead, you see all over in core that confirm_form() is used to build a form array from within a form builder function much like system_settings_form().
For system_settings_form(), the documentation reads "Add default buttons to a form and set its prefix."
Perhaps confirm_form() should follow suit with the "add" language instead of sounding like a valid form builder function itself. I'd also recommend dropping the first line of "Output a confirmation form" altogether as the function doesn't really do that.
Comment | File | Size | Author |
---|---|---|---|
#12 | confirm_form_d6.patch | 3.35 KB | mr.baileys |
#8 | confirm_form.patch | 3.33 KB | mr.baileys |
#6 | confirm_form.patch | 3.3 KB | mr.baileys |
#4 | confirm_form.patch | 2.98 KB | mr.baileys |
Comments
Comment #1
Barry Madore CreditAttribution: Barry Madore commentedMoving
Comment #2
betz CreditAttribution: betz commentedChanged the component to reflect the new component categorization. See http://drupal.org/node/301443
Comment #3
jhodgdonIt does indeed look like the doc for confirm_form() still needs updates as stated above...
http://api.drupal.org/api/function/confirm_form/7
Comment #4
mr.baileysHere's an attempt at improving the doxygen comments for confirm_form():
This is confusing at best, since confirm_form() does not have a submit handler. The submit handler belongs to the form builder function that invokes confirm_form(). Slightly reworded.
Comment #5
jhodgdonLooks fairly good, and it's definitely an improvement! A few things I think should be fixed:
a) $path - this can contain much more than just 'path', 'query', and 'fragment' components. It can have anything relevant for $options in http://api.drupal.org/api/function/l/7
b) Punctuation/style (not from your patch, but in this function):
Additional elements to inject into the form, for example hidden elements.
==>
Additional elements to add to the form; for example, hidden elements.
c) You might mention that the default for $yes is t('Submit') and for $no is t('Cancel'). Also, in other defaults, technically they are wrapped in t().
d) Grammar/usage:
A caption for the link which cancels ...
==>
A caption for the link that cancels ...
e) I guess from this documentation it is still not clear to me how you would define the submit handler, which might be a good idea to document, since it's mentioned in the doc?
Comment #6
mr.baileysThanks!
I've changed the wording for the $path parameter to explain that a $path array is passed as the $options parameter to l(). Also converted the "string or array" to a list.
I've added the defaults for $yes and $no, and wrapped the default for $description in t(). I left the examples for $yes and $no alone (not wrapped in t(), as these feel like (for lack of a better word) non-technical examples
I agree that this isn't particularly clear. What about:
?
Comment #7
jhodgdonGreat! I am very happy now with the text that you wrote for this function. There are still a couple of minor items to improve:
a) Punctuation:
- Additional elements to add to the form; for example hidden elements.
You need a comma after "for example,"
b) List formatting:
Please check out our guidelines for formatting lists on http://drupal.org/node/1354 (near the top). Precede with :, each item starts with capital letter, ends with period. Also Drupal should be capitalized.
c) The $no parameter still doesn't say what its default is.
Comment #8
mr.baileysThanks, fixed the remaining issues...
Comment #9
jhodgdonGreat work!
Comment #10
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.
Comment #11
jhodgdonWe should probably fix this in Drupal 6 as well. The documentation there is even worse.
Comment #12
mr.baileysHere is a straight re-roll for D6. The function itself hasn't changed between versions, but I'm not aware of differences between D6 and D7 doxygen guidelines so it might require some tweaking.
Comment #13
mr.baileysComment #14
jhodgdonLooks good to me. Thanks!
Comment #15
Gábor HojtsyThanks, committed to Drupal 6.