Some of the attributes used by theme_fieldset are optional, and some are required. The documentation should specify which is which.
--- includes/form.inc
+++ includes/form.inc
@@ -2624,6 +2624,7 @@ function form_get_options($element, $key) {
* - element: An associative array containing the properties of the element.
* Properties used: #attributes, #children, #collapsed, #collapsible,
* #description, #id, #title, #value.
+ * Required properties: #attributes (must be an Array), #children (must be a String).
*
* @ingroup themeable
*/
Comments
Comment #1
jhodgdonThanks for the issue report...
I am not completley happy with the solution, though. How about just saying:
Properties used (all are optional except as noted): #attributes (required, must be an array), #children (required, must be a string), #collapsed, ...
If you do want to make it a separate sentence, please (a) don't capitalize array/string, and (b) don't start this on a new line (continue the paragraph begun on the previous line).
Finally, when you attach a patch, please set the status to "needs review".
Thanks!
Comment #2
jhodgdonActually, maybe the elements should be made into a list?
Comment #3
pillarsdotnet commentedAs you wish. Actually, I'd rather change the function to gracefully deal with missing properties, but this is more likely to be accepted:
Comment #4
jhodgdonAt this point, I think you are correct that the documentation is more likely to be accepted.
The patch you attached here doesn't appear to be the right patch. The text you pasted into comment #3 looks good.
Comment #5
pillarsdotnet commentedLooking around, other docs that specify required vs. optional do it this way:
Comment #6
pillarsdotnet commentedMinor correction, with corresponding edit to the inline code above:
Comment #7
jhodgdonPlease just post patches. It isn't necessary to repeat the patch in the text of your comment. Thanks!
The version you have in the comment on #5 and the patch in #6 is not following our current standards, which are at:
http://drupal.org/node/1354
Use your browser to search for "optional" and you'll see what the standards are.
Comment #8
pillarsdotnet commentedThanks for the reference. Cleaned up according to the link you posted.
Comment #9
pillarsdotnet commentedComment #10
jhodgdonMuch better! A few minor edits needed:
a) + * - #description: (optional) A string to insert before the #children text
Needs to end in a .
b) + * - #title: (optional) A string to use as the fieldset title. If #collapsible
One space, not two, after the .
c) + * - #collapsed: (optional) Boolean whether the fieldset body is initially
(and the next one too) -- "Boolean whether the fieldset body..." is not a good sentence. You can probably change this to "Whether or not the fieldset body...", and leave out the word boolean, since "Defaults to FALSE" afterwards indicates that it is a boolean value.
d) Do you think we should add on #children something like "along with #description and #value"? And maybe indicate that this is normally built from the rendered children of the fieldset before the theme function is called?
Comment #11
pillarsdotnet commenteda) -- Done.
b) -- Done.
c) -- I don't like the wording either, but it's copied almost verbatim from the standards documentation you said I should follow.
d) -- Dunno; I don't know the history nor reasoning behind why the function works the way it does. The only reason I'm getting involved is because another contrib module uses this function wrongly, and I can't gripe at the author for failing to grasp the unclear documentation.
Somewhat improved (I think) patch:
Comment #12
pillarsdotnet commentedComment #13
jhodgdonThis version is fine, thanks!
I also fixed up the awkward wording around "Boolean whether" on the standards page. :)
Comment #14
pillarsdotnet commentedAfter receiving an education from Dave Reid and marcingy (See http://drupal.org/node/1004578#comment-3855230 and http://drupal.org/node/1004556#comment-3855212), I realize now the "required" vs. "optional" discussion is moot.
Correcting...
Comment #16
marcingy commentedClosing as this isn't a bug.
Comment #17
pillarsdotnet commented@jhodgdon -- see http://drupal.org/node/1004852
@marcingy -- You're right. Adjusting accordingly.
Comment #18
marcingy commentedComment #19
jabeeroo commented#17: form.inc_.patch queued for re-testing.
Comment #20
pillarsdotnet commented