Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.787 diff -u -u -p -r1.787 common.inc --- includes/common.inc 17 Aug 2008 11:08:23 -0000 1.787 +++ includes/common.inc 20 Aug 2008 23:38:27 -0000 @@ -2949,6 +2949,9 @@ function drupal_common_theme() { 'indentation' => array( 'arguments' => array('size' => 1), ), + 'cols' => array( + 'arguments' => array('form' => NULL), + ), // from pager.inc 'pager' => array( 'arguments' => array('tags' => array(), 'limit' => 10, 'element' => 0, 'parameters' => array()), Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.432 diff -u -u -p -r1.432 theme.inc --- includes/theme.inc 16 Aug 2008 21:05:49 -0000 1.432 +++ includes/theme.inc 20 Aug 2008 23:38:27 -0000 @@ -1694,6 +1694,34 @@ function theme_indentation($size = 1) { } /** + * Implement handy way for forms to easily theme the buttons into columns. + * Put '#theme' => 'cols' on your form element (probably a fieldset). + * + * @param $form + * FAPI passes the form element + */ +function theme_cols($form) { + $cols = isset($form['#cols']) ? $form['#cols'] : 3; + $children = element_children($form); + $total = count($children); + $total = (int) (($total % $cols) ? (($total + $cols - 1) / $cols) : ($total / $cols)); + $pos = 0; + $rows = array(); + $percent = ((int) (100 / $cols)) .'%'; + foreach ($children as $key) { + $element = $form[$key]; + $pos ++; + $row = $pos % $total; + $col = $pos / $total; + if (!isset($rows[$row])) { + $rows[$row] = array(); + } + $rows[$row][$col] = array('data' => drupal_render($element), 'width' => $percent); + } + return theme('table', array(), $rows); +} + +/** * @} End of "defgroup themeable". */ Index: modules/filter/filter.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v retrieving revision 1.13 diff -u -u -p -r1.13 filter.admin.inc --- modules/filter/filter.admin.inc 24 Jul 2008 16:27:51 -0000 1.13 +++ modules/filter/filter.admin.inc 20 Aug 2008 23:38:27 -0000 @@ -126,6 +126,7 @@ function filter_admin_format_form(&$form '#title' => t('Roles'), '#description' => $default ? $help : t('Choose which roles may use this filter format. Note that roles with the "administer filters" permission can always use all the filter formats.'), '#tree' => TRUE, + '#theme' => 'cols', ); foreach (user_roles() as $rid => $name) { @@ -146,6 +147,8 @@ function filter_admin_format_form(&$form '#title' => t('Filters'), '#description' => t('Choose the filters that will be used in this filter format.'), '#tree' => TRUE, + '#theme' => 'cols', + '#cols' => 2, ); foreach ($all as $id => $filter) { $form['filters'][$id] = array('#type' => 'checkbox', Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.916 diff -u -u -p -r1.916 user.module --- modules/user/user.module 17 Aug 2008 10:46:30 -0000 1.916 +++ modules/user/user.module 20 Aug 2008 23:38:27 -0000 @@ -1471,6 +1471,7 @@ function user_edit_form(&$form_state, $u '#title' => t('Roles'), '#default_value' => $default, '#options' => $roles, + '#theme' => 'cols', DRUPAL_AUTHENTICATED_RID => $checkbox_authenticated, ); }