I created a custom layout for a panels display and I would like to have a region or multiple regions in my custom layout be collapsible with javascript/jquery. Ideally the state of the collapible region would also be remembered by a cookie, but first thing is the collapsible functionality. Can anyone help?

<fieldset class="collapsible collapsed">
Title of fieldset goes here.
Content goes here.
  • I found your question while seeking the same. Did you ever find your solution? I can share what doesn't work: * looking for fieldset/div as something out of the box in Panels * hook_form_alter to move fields around (works but ctools throws PHP notice) * adding fieldset/div (via field_group module) to node in Manage Fields screen * adding fieldset And scooting some fields in (in manage fields screen) Any other ideas? Sorry about the formatting here-- I can't seem to break a line for you. Apr 2 '14 at 18:37

The best I've come up with so far is a custom module's hook_form_alter to create a fieldset and move fields in. Note that in order to avoid something like:

Notice: Undefined index: field_txt_student_id in ctools_entity_form_field_content_type_render() (line 96 of [...]/sites/all/modules/contrib/ctools/plugins/content_types/form/entity_form_field.inc).

because the field is moved and unset(), it is not known by ctools to have been moved (or something). Its render function does basic data sanity checking but then goes with the assumption that this field still exists by name where it was before the alter.

To get around that, instead of unset()'ing the original field, set it to a non-kind-of-field per this thread.

//  unset($form[$fieldname]);
$form[$fieldname] = array('#language' => NULL);

Would love to hear what other solutions exist! I spilled my "solutions that don't work" in a comment on your original question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.