diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-06-21 09:45:45 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-06-21 09:45:45 +0000 |
commit | e550f8416210489aedd88a73cdc3c5b614edc574 (patch) | |
tree | 4bfe99c1e26afb24555e144a284abb67fae52df8 /includes/common.inc | |
parent | e16e048d577236daded1ad13a3913ba202d7db0f (diff) | |
download | brdo-e550f8416210489aedd88a73cdc3c5b614edc574.tar.gz brdo-e550f8416210489aedd88a73cdc3c5b614edc574.tar.bz2 |
- 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.
Diffstat (limited to 'includes/common.inc')
-rw-r--r-- | includes/common.inc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc index 8648f8626..0cd68bb4a 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -1110,6 +1110,33 @@ function form_group($legend, $group, $description = NULL, $attributes = NULL) { } /** + * 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 '<fieldset' . drupal_attributes($attributes) .'>' . ($legend ? '<legend>'. $legend .'</legend>' : '') . $group . ($description ? '<div class="description">'. $description .'</div>' : '') . "</fieldset>\n"; +} + +/** * Format a radio button. * * @param $title |