From e550f8416210489aedd88a73cdc3c5b614edc574 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 21 Jun 2005 09:45:45 +0000 Subject: - Patch #16204 by Thox: committed the collapsible form elements patch. NOTE: this patch works well, but the improved node edit form still has some rough edges. It is important that we continue to improve usability. Give it a try. --- includes/common.inc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'includes/common.inc') diff --git a/includes/common.inc b/includes/common.inc index 8648f8626..0cd68bb4a 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -1109,6 +1109,33 @@ function form_group($legend, $group, $description = NULL, $attributes = NULL) { return '' . ($legend ? ''. $legend .'' : '') . $group . ($description ? '
'. $description .'
' : '') . "\n"; } +/** + * Format a group of form items. + * + * @param $legend + * The label for the form item group. + * @param $group + * The form items within the group, as an HTML string. + * @param $collapsed + * A boolean value decided whether the group starts collapsed. + * @param $description + * Explanatory text to display after the form item group. + * @param $attributes + * An associative array of HTML attributes to add to the fieldset tag. + * @return + * A themed HTML string representing the form item group. + */ +function form_group_collapsible($legend, $group, $collapsed = FALSE, $description = NULL, $attributes = NULL) { + drupal_add_js('misc/collapse.js'); + + $attributes['class'] .= ' collapsible'; + if ($collapsed) { + $attributes['class'] .= ' collapsed'; + } + + return '' . ($legend ? ''. $legend .'' : '') . $group . ($description ? '
'. $description .'
' : '') . "\n"; +} + /** * Format a radio button. * -- cgit v1.2.3