Skip to main content
added 410 characters in body
Source Link
Clive
  • 167.9k
  • 19
  • 303
  • 337

You're missing a closing </fieldset> tag which probably won't be helping things, but I wouldn't advise doing it the way you currently are anyway.

A better way would be to make use of the theme_fieldset() function like so:

// Make sure the collapsible library is loaded
drupal_add_library('system', 'drupal.collapse');

// Build up the fieldset
$fieldset = array(
  '#theme' => 'fieldset',
  '#title' => 'Viste aggiuntive',
  '#attributes' => array('class' => array('collapsible', 'collapsed')),
  '#description' => 'fieldset extra.',
  '#children' => '<div><p class="home_body "><a href="?q=vista_progetti_categoria/1"><strong>Vista progetti</strong></a></p></div></fieldset>'
);

// Add it to the body
$body .= render($fieldset);

That works great for me.

You might want to replace the call to render() above with drupal_render() as it offers a minute performance increase; I tend to use render() for all my calls for this sort of thing for continuity, and so that I don't have to check the type of the data being passed.

In this case, as you know the argument is not a string, you could save yourself the few microseconds and use drupal_render() instead.

You're missing a closing </fieldset> tag which probably won't be helping things, but I wouldn't advise doing it the way you currently are anyway.

A better way would be to make use of the theme_fieldset() function like so:

// Make sure the collapsible library is loaded
drupal_add_library('system', 'drupal.collapse');

// Build up the fieldset
$fieldset = array(
  '#theme' => 'fieldset',
  '#title' => 'Viste aggiuntive',
  '#attributes' => array('class' => array('collapsible', 'collapsed')),
  '#description' => 'fieldset extra.',
  '#children' => '<div><p class="home_body "><a href="?q=vista_progetti_categoria/1"><strong>Vista progetti</strong></a></p></div></fieldset>'
);

// Add it to the body
$body .= render($fieldset);

That works great for me.

You're missing a closing </fieldset> tag which probably won't be helping things, but I wouldn't advise doing it the way you currently are anyway.

A better way would be to make use of the theme_fieldset() function like so:

// Make sure the collapsible library is loaded
drupal_add_library('system', 'drupal.collapse');

// Build up the fieldset
$fieldset = array(
  '#theme' => 'fieldset',
  '#title' => 'Viste aggiuntive',
  '#attributes' => array('class' => array('collapsible', 'collapsed')),
  '#description' => 'fieldset extra.',
  '#children' => '<div><p class="home_body "><a href="?q=vista_progetti_categoria/1"><strong>Vista progetti</strong></a></p></div></fieldset>'
);

// Add it to the body
$body .= render($fieldset);

That works great for me.

You might want to replace the call to render() above with drupal_render() as it offers a minute performance increase; I tend to use render() for all my calls for this sort of thing for continuity, and so that I don't have to check the type of the data being passed.

In this case, as you know the argument is not a string, you could save yourself the few microseconds and use drupal_render() instead.

Source Link
Clive
  • 167.9k
  • 19
  • 303
  • 337

You're missing a closing </fieldset> tag which probably won't be helping things, but I wouldn't advise doing it the way you currently are anyway.

A better way would be to make use of the theme_fieldset() function like so:

// Make sure the collapsible library is loaded
drupal_add_library('system', 'drupal.collapse');

// Build up the fieldset
$fieldset = array(
  '#theme' => 'fieldset',
  '#title' => 'Viste aggiuntive',
  '#attributes' => array('class' => array('collapsible', 'collapsed')),
  '#description' => 'fieldset extra.',
  '#children' => '<div><p class="home_body "><a href="?q=vista_progetti_categoria/1"><strong>Vista progetti</strong></a></p></div></fieldset>'
);

// Add it to the body
$body .= render($fieldset);

That works great for me.