Collapsible fieldsets in Drupal 7 nodes
After struggling with various adoptions for getting collapsible fieldsets to work within nodes for Drupal 7 I came across a final solution.
Make adjustments to template.php (or in a module if you prefer):
function THEMENAME_preprocess_html(&$variables){
// This function looks for node 1 and only adds the javascript for this.
// However it can be extended in different ways if required
if ($variables['node']['nid'] = 1){
drupal_add_js('misc/form.js');
drupal_add_js('misc/collapse.js');
}
}
In D7 you must also make sure that your legend contains a span with class "fieldset-legend", and that your content is contained in a div with class "fieldset-description", and that you include "misc/form.js" for your javascript. Then it’ll work.
Example
<fieldset id="fieldset-id" class="collapsible"> <legend><span class="fieldset-legend">Fieldset title</span></legend> <div class="fieldset-wrapper"> <div class="fieldset-description">Fieldset description</div> Fieldset content </div> </fieldset>





Comments
turning wordpress to drupal
i want to convert my blog http://addsiteurl.net/blog which is a wordpress blog to drupal blog can it be done