Hello,

I’m trying to create a collapsible/expandable box for the location fieldset in Location_CCK but don’t know how to do such a thing. If anyone can help, I’d appreciate it.

Comments

rooby’s picture

Status: Active » Fixed

You could create a custom module and use hook_form_alter() like this

<?php
/**
 * Implementation of hook_form_alter().
 */
function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'nodetype_node_form') {
    // Add the fieldset for the location cck field.
    $form['location_cck_fieldset'] = array(
      '#type' => 'fieldset',
      '#title' => t('Locations'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    // Copy the locations field to the fieldset.
    $form['location_fieldset']['field_location'] = $form['field_location'];
    // Remove the original locations field.
    unset($form['field_location']);
  }
}
?>

In this example you need to change the mymodule in the function name to the name of your moule, the form_id check from nodetype_node_form to whatever your form id is and field_location to whatever the name of your field is.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.