Index: includes/locale.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/locale.inc,v retrieving revision 1.231 diff -u -p -r1.231 locale.inc --- includes/locale.inc 9 Oct 2009 16:33:13 -0000 1.231 +++ includes/locale.inc 10 Oct 2009 04:32:00 -0000 @@ -79,27 +79,70 @@ function locale_languages_overview_form( } /** + * Preprocess variables for theme_locale_languages_overview_form(). + * + * @see theme_locale_languages_overview_form(). + * + * @ingroup themeable + */ +function template_preprocess_locale_languages_overview_form(&$variables) { + $default = language_default(); + $variables['operations_links'] = array(); + foreach ($variables['form']['name'] as $key => $element) { + // Do not take form control structures. + if (is_array($element) && element_child($key)) { + // Disable checkbox for the default language, because it cannot be + // disabled. + if ($key == $default->language) { + $variables['form']['enabled'][$key]['#attributes']['disabled'] = 'disabled'; + } + // Add operations links appropriate for each language. + $variables['operations_links'][$key][] = array( + 'title' => t('edit'), + 'href' => 'admin/config/regional/language/edit/' . $key, + ); + if ($key != 'en' && $key != $default->language) { + $variables['operations_links'][$key][] = array( + 'title' => t('delete'), + 'href' => 'admin/config/regional/language/delete/' . $key, + ); + } + } + } +} + +/** * Theme the language overview form. * * @param $variables * An associative array containing: * - form: @todo: document + * - operations_links: An associative array keyed on language code. For each + * language, the value of the array is itself an array of links, suitable + * for passing to theme('links'). * * @return * A themed HTML string representing the form. * + * @see template_preprocess_locale_languages_overview_form() + * * @ingroup themeable */ function theme_locale_languages_overview_form($variables) { $form = $variables['form']; + $operations_links = $variables['operations_links']; $default = language_default(); foreach ($form['name'] as $key => $element) { // Do not take form control structures. if (is_array($element) && element_child($key)) { - // Disable checkbox for the default language, because it cannot be disabled. - if ($key == $default->language) { - $form['enabled'][$key]['#attributes']['disabled'] = 'disabled'; + // theme('links', array('links' => $operations_links[$key])) would create + // an unordered list of links, but we just want a space separated set of + // links. + $operations_links_rendered = array(); + foreach ($operations_links[$key] as $link) { + $operations_links_rendered[] = l($link['title'], $link['href'], $link); } + $operations_links_rendered = implode(' ', $operations_links_rendered); $rows[] = array( 'data' => array( '' . drupal_render($form['name'][$key]) . '', @@ -109,7 +152,7 @@ function theme_locale_languages_overview array('data' => drupal_render($form['enabled'][$key]), 'align' => 'center'), drupal_render($form['site_default'][$key]), drupal_render($form['weight'][$key]), - l(t('edit'), 'admin/config/regional/language/edit/' . $key) . (($key != 'en' && $key != $default->language) ? ' ' . l(t('delete'), 'admin/config/regional/language/delete/' . $key) : '') + $operations_links_rendered, ), 'class' => array('draggable'), ); Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.533 diff -u -p -r1.533 theme.inc --- includes/theme.inc 9 Oct 2009 16:33:13 -0000 1.533 +++ includes/theme.inc 10 Oct 2009 04:32:00 -0000 @@ -1738,22 +1738,46 @@ function theme_table_select_header_cell( } /** + * Preprocess variables for theme_tablesort_indicator(). + * + * @see theme_tablesort_indicator(). + * + * @ingroup themeable + */ +function template_preprocess_tablesort_indicator(&$variables) { + $variables['image_properties_by_style'] = array( + 'asc' => array('path' => 'misc/arrow-asc.png', 'alt' => t('sort icon'), 'title' => t('sort ascending')), + 'desc' => array('path' => 'misc/arrow-desc.png', 'alt' => t('sort icon'), 'title' => t('sort descending')), + ); +} + +/** + * Process variables for theme_tablesort_indicator(). + * + * @see theme_tablesort_indicator(). + * + * @ingroup themeable + */ +function template_process_tablesort_indicator(&$variables) { + $variables['image_properties'] = ($variables['style'] == "asc") ? $variables['image_properties_by_style']['asc'] : $variables['image_properties_by_style']['desc']; +} + +/** * Return a themed sort icon. * * @param $variables * An associative array containing: * - style: Set to either asc or desc. This sets which icon to show. + * - image_properties_by_style: A keyed array by style. For each style, the + * variables to pass to theme('image'). + * - image_properties: The variables to pass to theme('image') for the desired + * style. * * @return * A themed sort icon. */ function theme_tablesort_indicator($variables) { - if ($variables['style'] == "asc") { - return theme('image', array('path' => 'misc/arrow-asc.png', 'alt' => t('sort icon'), 'title' => t('sort ascending'))); - } - else { - return theme('image', array('path' => 'misc/arrow-desc.png', 'alt' => t('sort icon'), 'title' => t('sort descending'))); - } + return theme('image', $variables['image_properties']); } /** Index: modules/locale/locale.module =================================================================== RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v retrieving revision 1.261 diff -u -p -r1.261 locale.module --- modules/locale/locale.module 9 Oct 2009 16:33:13 -0000 1.261 +++ modules/locale/locale.module 10 Oct 2009 04:32:01 -0000 @@ -369,6 +369,8 @@ function locale_theme() { return array( 'locale_languages_overview_form' => array( 'arguments' => array('form' => array()), + 'path' => 'includes', + 'file' => 'locale.inc', ), 'locale_languages_configure_form' => array( 'arguments' => array('form' => array()), Index: themes/seven/template.php =================================================================== RCS file: /cvs/drupal/drupal/themes/seven/template.php,v retrieving revision 1.7 diff -u -p -r1.7 template.php --- themes/seven/template.php 9 Oct 2009 01:00:08 -0000 1.7 +++ themes/seven/template.php 10 Oct 2009 04:32:03 -0000 @@ -55,19 +55,14 @@ function seven_admin_block_content($vari } /** - * Override of theme_tablesort_indicator(). + * Preprocess variables for theme_tablesort_indicator(). * * Use our own image versions, so they show up as black and not gray on gray. */ -function seven_tablesort_indicator($variables) { - $style = $variables['style']; +function seven_preprocess_tablesort_indicator(&$variables) { $theme_path = drupal_get_path('theme', 'seven'); - if ($style == "asc") { - return theme('image', array('path' => $theme_path . '/images/arrow-asc.png', 'alt' => t('sort icon'), 'title' => t('sort ascending'))); - } - else { - return theme('image', array('path' => $theme_path . '/images/arrow-desc.png', 'alt' => t('sort icon'), 'title' => t('sort descending'))); - } + $variables['image_properties_by_style']['asc']['path'] = $theme_path . '/images/arrow-asc.png'; + $variables['image_properties_by_style']['desc']['path'] = $theme_path . '/images/arrow-desc.png'; } /**