Jake's blog

Format Drupal's collapsible fieldset's legend as a header block

I am using Drupal's collapsible fieldsets for several projects and ran into two issues.

The first issue was that the state of a collapsible fieldset was not being saved, so I wrote and contributed a fieldset helper module that saves the state of Drupal's collapsible fieldsets.

The second issue, which is a problem for all fieldsets and not just Drupal, is it is very difficult to style a fieldset's legend as a header block. Typically, the legend is layered over a fieldset's border.

print_r is not pretty

I feel that PHP's print_r() function and Drupal's Devel module's dprint_r() function's output is not pretty or friendly because the generated code needs to be interpretted and translated into a usable PHP string that can then be inserted into a PHP template or script. So I decided to write a new debugging function, called dprint_rx(). My dprint_rx() function outputs a list of usable PHP strings, enhanced with some color coding and JavaScript, that can be easily cut-n-pasted directly into a PHP template or script.

Here is an example of my dprint_rx() function's output compared to the Devel module's dprint_r() function's output.

Syndicate content