I really don’t get why this is not working. I want to avoid a specific form item being collapsed.
This is my element I want to modify (after the change with the code below):
[taxonomy] => Array
(
[tags] => Array
(
[1] => Array
(
[#type] => textfield
[#title] => Tags
[#description] => A comma-separated list of terms describing this content. Example: funny, bungee jumping, "Company, Inc.".
[#required] => 0
[#default_value] =>
[#autocomplete_path] => taxonomy/autocomplete/1
[#weight] => 0
[#maxlength] => 1024
[#collapsed] => 0
[#collapsible] => 0
)
[#collapsed] => 0
[#collapsible] => 0
)
[#weight] => -3
[#tree] => 1
[#collapsed] => 0
[#collapsible] => 0
This is my code in hook_form_alter (I’m sure the form is modified by the code):
$form['taxonomy']['#collapsed'] = 0;
$form['taxonomy']['tags']['#collapsed'] = 0;
$form['taxonomy']['tags'][2]['#collapsed'] = 0;
$form['taxonomy']['#collapsible'] = 0;
$form['taxonomy']['tags']['#collapsible'] = 0;
$form['taxonomy']['tags'][3]['#collapsible'] = 0;
But it doesn’t work. The element is always collapsed. And I’ve refreshed all caches

http://dl.dropbox.com/u/72686/tagsform.txt
Update2:
$form['taxonomy']['#required'] = TRUE;
$form['taxonomy']['tags']['#required'] = TRUE;
$form['taxonomy']['tags'][5]['#required'] = TRUE;

From the array you posted, it looks like you try to adjust the form element before taxonomy module actually turned it into a fieldset (note that there is no
'#type' => 'fieldset'declaration in that array). If you take look attaxonomy_form_alter(), you can see that it is in thathook_form_alter()implementation, that the taxonomy array in the node gets ‘converted’ into actual forms API elements.So my guess is that your adjustments reside in a
hook_form_alter()implementation that runs before that of the taxonomy module, so that your declarations for the collapsed states get overwritten by taxonomy module immediately after you set them.Try to adjust your modules weight to something higher than that of taxonomy module and see if this changes things. (Be aware that changing the weight might effect other things that your module does, so test carefully after doing it!)