Project:Content Templates (Contemplate)
Version:6.x-1.1
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I'm using ConTemplate for a node with three different collapsible field sets. I've got the template generating html that matches the previous non-ConTemplate version, but the collapsible field sets are not operating.

I thought that the ConTemplate version was simply missing some javascript "$(document).ready()" logic to attach a collapsing callback to the link that handles the collapsing, but another page that I have with CCK collapsing field sets does not appear to have any such javascript "$(document).ready()" logic...

Any idea what is necessary to get the collapsing field sets to operate?

Comments

#1

Got it working. (but one issue at the bottom of this post.) Solution for others, inside the Body Variables of a ConTemplate template there are group fields like "$node->content['group_location']['#children']" that can be used. If such groups are specified as collapsible when the CCK field is configured, that Body Variable will also be collapsible.

Additionally, if one wants a different layout (with collapse ability), the key seems to be setting up the field set like this:

<fieldset class="fieldgroup group-YourGroupName collapsible">
   <legend>
     <a href="#">Your Group Title</a>
   </legend>
     ... your layout here ...
</fieldset>

not like this (which is how it may appear in firebug's inspect):

<fieldset class="fieldgroup group-YourGroupName collapsible">
   <legend class="collapse-processed">
     <a href="#">Your Group Title</a>
   </legend>
     ... your layout here ...
</fieldset>

These operate the same (both the Body Variable form and the hand coded form) but suffer from fairly serious browser flashing. I'm on a fairly nice Mac Powerbook, and the flashing is the entire browser window during a collapse. The flashing is much less on an expand, but still visible. A non-ConTemplate collapsible CCK field group does not flash like this...

Any idea where to look or how to fix?

#2

this is the way I do it when I want a collapsible fieldset:

<?php
  $element
= array(
   
'#title' => 'this is my fieldset legend',
   
'#description' => 'this is anything I want in the fieldset as a description',
   
'#value' => 'this is my content inside the fieldset',
   
'#attributes' => array(
     
'class' => 'my_fieldset_class',
     
'id' => 'my_fieldset_id',
    ),
   
'#collapsible' => TRUE, // do you want it to be collapsible
   
'#collapsed' => TRUE; // do you want it to start out collapsed
 
);
  print
theme('fieldset', $element);
?>

this will print out the fieldset you want, for more information: http://api.drupal.org/api/function/theme_fieldset/6

#3

Thank you James. I had not seen that before, very helpful!!!

-Blake

nobody click here