Index: misc/form.js =================================================================== RCS file: /cvs/drupal/drupal/misc/form.js,v retrieving revision 1.2 diff -u -p -r1.2 form.js --- misc/form.js 29 Oct 2008 10:01:26 -0000 1.2 +++ misc/form.js 8 Nov 2008 12:53:41 -0000 @@ -10,3 +10,18 @@ Drupal.behaviors.multiselectSelector = { }); } }; + +Drupal.behaviors.filterGuildelines = { + attach: function (context) { + // Automatically displays the guidelines of the selected input format. + $('.filter-guidelines:not(.filterGuidelines-processed)', context) + .addClass('filterGuidelines-processed') + .parents('.filter-wrapper').find('select.filter-list') + .bind('change', function() { + $(this).parents('.filter-wrapper') + .find('.filter-guidelines-item').hide() + .siblings('#filter-guidelines-' + this.value).show(); + }) + .change(); + } +}; Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.231 diff -u -p -r1.231 filter.module --- modules/filter/filter.module 1 Nov 2008 19:51:06 -0000 1.231 +++ modules/filter/filter.module 8 Nov 2008 12:53:42 -0000 @@ -58,7 +58,10 @@ function filter_theme() { 'file' => 'filter.pages.inc', ), 'filter_tips_more_info' => array( - 'arguments' => array(), + 'arguments' => array('icon' => FALSE), + ), + 'filter_guidelines' => array( + 'arguments' => array('format' => NULL), ), ); } @@ -477,32 +480,31 @@ function filter_form($value = FILTER_FOR $value = filter_resolve_format($value); $formats = filter_formats(); - $extra = theme('filter_tips_more_info'); + $form = array( + '#type' => 'fieldset', + '#weight' => $weight, + '#attributes' => array('class' => 'filter-wrapper'), + ); if (count($formats) > 1) { - $form = array( - '#type' => 'fieldset', - '#title' => t('Input format'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#weight' => $weight, - '#element_validate' => array('filter_form_validate'), - ); - // Multiple formats available: display radio buttons with tips. + // Multiple formats available: display dropdown select list. + drupal_add_js('misc/form.js', 'core'); foreach ($formats as $format) { - // Generate the parents as the autogenerator does, so we will have a - // unique id for each radio button. - $parents_for_id = array_merge($parents, array($format->format)); - $form[$format->format] = array( - '#type' => 'radio', - '#title' => $format->name, - '#default_value' => $value, - '#return_value' => $format->format, - '#parents' => $parents, - '#description' => theme('filter_tips', _filter_tips($format->format, FALSE)), - '#id' => form_clean_id('edit-' . implode('-', $parents_for_id)), - ); + $options[$format->format] = $format->name; + $guidelines[$format->format] = array('#markup' => theme('filter_guidelines', $format)); } + $element_id = form_clean_id('edit-' . implode('-', $parents)); + $form['format'] = array( + '#type' => 'select', + '#title' => t('Formatting'), + '#options' => $options, + '#default_value' => $value, + '#parents' => $parents, + '#id' => $element_id, + '#attributes' => array('class' => 'filter-list'), + ); + $form['format_help'] = array('#markup' => '
' . l(t('More information about formatting options'), 'filter/tips') . '
'; +function theme_filter_tips_more_info($icon = FALSE) { + if ($icon) { + $description = t('More information about formatting options'); + return l(theme('image', 'misc/help.png', $description, $description), 'filter/tips', array('html' => TRUE)); + } + else { + return ''. l(t('More information about formatting options'), 'filter/tips') .'
'; + } +} + +/** + * Format guidelines for an input format. + * + * @ingroup themeable + */ +function theme_filter_guidelines($format) { + return '