Hi,

I'm finding that my users are not entering important information into node submission forms because they don't notice there is a collapsed fieldset. I would therefore like to turn these off for for my various content types. How can I do this without damaging core functionality?

Specifically things I need to stop hiding is the fieldsets for upload.module and also the location.module.

Thanks,

Alex

Comments

SolarFlare’s picture

Isn't this an option in the content type edit page?
Or maybe in the group's configuration page.

dharmatech’s picture

You could write a module that implements hook_form_alter().

For example, to open up the "published/promote to front page/etc." fieldset, you could use
$form['options']['#collapsed'] = FALSE;

Lullabot has a page on it... http://www.lullabot.com/articles/modifying-forms-5-and-6

ALT83’s picture

Thanks guys, but surely there must be a simpler way than creating a whole module to do this?

SolarFlare, I think there may be some kind of options if this were a CCK field, but it's not, it's the actual upload.module ("File Attachments") fieldset and also the "Location" fieldset created by location.module

dharmatech’s picture

Creating a module to accomplish a task isn't so bad. However, you might be able to override the fieldset in the theme by implementing phptemplate_fieldset() in template.php.

Never tried it so I don't know if it will work but it seems like it should.

dkyadav80’s picture

I wanna learn drupal but i know installation what i will do after installation .
pls refer quick guide link in PDF format if any. and how i can develope our personal site in drupal.
and how can build ourt template/themes in drupal.
Pls help me.
Thanks
from webbee.biz

problue solutions’s picture

I would also find it helpful to be able to do this, specifically for the Image Attach collapsed group in my case.

BassistJimmyJam’s picture

I wanted to do the same thing for the "File attachments" fieldset on my forum post content type. I acheived this by adding the following to my theme's template.php:

/**
* Implementation of theme_fieldset(), used to achieve custom styling of
* fieldsets on the node form.
*/
function phptemplate_fieldset($element, $b = null) {
  // check to see if we have a node id
  $node_type = arg(2);
  if ($node_type != 'forum' && is_numeric(arg(1))) {
    $node = node_load(arg(1));
    $node_type = $node->type;
  } // end if we have a node id

  // check to see if this is the file attachments fieldset for a forum node
  if ($element['#title'] == t('File attachments') && $node_type == 'forum') {
    $element['#collapsed'] = false;
  } // end if this is the file attachments fieldset for a forum node

  return theme_fieldset($element);
} // end function phptemplate_fieldset()

If you want to turn of collapsing completely for the fieldset, just set $element['#collapsible'] = false.

freefall235’s picture

Thanks for the reply BassistJimmyJam,

But would there be any way to remove this element from the form altogether?

I wish to hide the file attachments node for a specific node.

Cheers,
Justin

tsi’s picture

Thanx BassistJimmyJam, works great !

Tsachi Shlidor (@shlidor)