William, thank you for your time. You gave me a nice step up the learning curve.
For those of you following along at home, here is the module (perhaps I will create a full blown module that will allow admins to change the default expand/collapse for each section in each node type (that sounds a bit intimidating still)).
In the meantime, create two files, put them in a new subdirectory under the appropriate modules directory (e.g. myformalter)
First file: myformalter.module <?php // $Id:
/** * @file * Module to modify form to expand author and attachments sections */
/** * Implementation */
function myformalter_form_alter($form_id, &$form) { //enable the following to get a view of all the variables //print $form_id . "<br>"; //print "<pre>"; print_r($form); print "</pre>"; if ($form_id == 'nameofyournode_node_form') { $form['attachments']['#collapsed'] = FALSE; $form['author']['#collapsed'] = FALSE; } }
Second File: myformalter.info ; $Id$ name = MYFormAlter description = Modifies form specified as specified in txt file package = 00-my version = "1.0"
Start with this .. change:
function myformalter_form_alter($form _id, &$form) { if ($form_id == 'edit-junk-node-form') { $form['attachments']['#collapsed'] = FALSE; $form['author']['#collapsed'] = FALSE; } }
to:
function myformalter_form_alter($form _id, &$form) { print $form_id . "<br>"; print "<pre>"; print_r($form); print "</pre>";
if ($form_id == 'edit-junk-node-form') { $form['attachments']['#collapsed'] = FALSE; $form['author']['#collapsed'] = FALSE; } }
When you go to the submission page, it wil spit out the form id. Make sure this matches "edit-junk-node-form" (I suspect it doesn't, form ids don't usually start with 'edit').
If it does match, check the rest of the output and make sure 'attachments' and 'author' are correct array indexes to be targeting.
William.