Insert a collapsible fieldset or region in a panels layout 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?

&lt;fieldset class="collapsible collapsed"&gt;
&lt;legend&gt;
Title of fieldset goes here.
&lt;/legend&gt;
&lt;p&gt;
Content goes here.
&lt;/p&gt;
&lt;/fieldset&gt;
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' =&gt; NULL);


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