Index: install.php =================================================================== RCS file: /cvs/drupal/drupal/install.php,v retrieving revision 1.210 diff -u -p -r1.210 install.php --- install.php 18 Sep 2009 00:12:45 -0000 1.210 +++ install.php 28 Sep 2009 22:42:40 -0000 @@ -263,7 +263,7 @@ function install_begin_request(&$install require_once DRUPAL_ROOT . '/includes/cache-install.inc'; $conf['cache_inc'] = 'includes/cache.inc'; $conf['cache_default_class'] = 'DrupalFakeCache'; - + // Prepare for themed output, if necessary. We need to run this at the // beginning of the page request to avoid a different theme accidentally // getting set. @@ -679,9 +679,9 @@ function install_display_output($output, // Let the theming function know when every step of the installation has // been completed. $active_task = $install_state['installation_finished'] ? NULL : $install_state['active_task']; - drupal_add_region_content('sidebar_first', theme_task_list(install_tasks_to_display($install_state), $active_task)); + drupal_add_region_content('sidebar_first', theme('task_list', array('items' => install_tasks_to_display($install_state), 'active' => $active_task))); } - print theme($install_state['database_tables_exist'] ? 'maintenance_page' : 'install_page', $output); + print theme($install_state['database_tables_exist'] ? 'maintenance_page' : 'install_page', array('content' => $output)); exit; } @@ -708,7 +708,7 @@ function install_verify_requirements(&$i if ($severity == REQUIREMENT_ERROR) { if ($install_state['interactive']) { drupal_set_title(st('Requirements problem')); - $status_report = theme('status_report', $requirements); + $status_report = theme('status_report', array('requirements' => $requirements)); $status_report .= st('Check the error messages and proceed with the installation.', array('!url' => request_uri())); return $status_report; } @@ -956,7 +956,7 @@ function install_database_errors($databa $databases['default']['default'] = $database; try { db_run_tasks($database['driver']); - } + } catch (DatabaseTaskException $e) { // These are generic errors, so we do not have any specific key of the // database connection array to attach them to; therefore, we just put @@ -1025,7 +1025,8 @@ function install_select_profile(&$instal if ($install_state['interactive']) { include_once DRUPAL_ROOT . '/includes/form.inc'; drupal_set_title(st('Select an installation profile')); - return drupal_render(drupal_get_form('install_select_profile_form', $install_state['profiles'])); + $form = drupal_get_form('install_select_profile_form', $install_state['profiles']); + return drupal_render($form); } else { throw new Exception(install_no_profile_error()); @@ -1076,7 +1077,7 @@ function install_select_profile_form($fo foreach ($profile_files as $profile) { // TODO: is this right? include_once DRUPAL_ROOT . '/' . $profile->uri; - + $details = install_profile_info($profile->name); $profiles[$profile->name] = $details; @@ -1680,7 +1681,7 @@ function install_configure_form_submit($ // Enable update.module if this option was selected. if ($form_state['values']['update_status_module'][1]) { drupal_install_modules(array('update')); - + // Add the site maintenance account's email address to the list of // addresses to be notified when updates are available, if selected. if ($form_state['values']['update_status_module'][2]) { Index: update.php =================================================================== RCS file: /cvs/drupal/drupal/update.php,v retrieving revision 1.305 diff -u -p -r1.305 update.php --- update.php 28 Sep 2009 22:16:32 -0000 1.305 +++ update.php 28 Sep 2009 22:42:40 -0000 @@ -66,7 +66,7 @@ function update_script_selection_form() '#value' => $update['start'], ); $form['start'][$module . '_updates'] = array( - '#markup' => theme('item_list', $update['pending'], $module . ' module'), + '#markup' => theme('item_list', array('items' => $update['pending'], 'title' => $module . ' module')), ); } if (isset($update['pending'])) { @@ -78,7 +78,7 @@ function update_script_selection_form() drupal_set_message(t('No pending updates.')); unset($form); $form['links'] = array( - '#markup' => theme('item_list', update_helpful_links()), + '#markup' => theme('item_list', array('items' => update_helpful_links())), ); } else { @@ -136,7 +136,7 @@ function update_results_page() { $output .= "

Reminder: don't forget to set the \$update_free_access value in your settings.php file back to FALSE.

"; } - $output .= theme('item_list', $links); + $output .= theme('item_list', array('items' => $links)); // Output a list of queries executed if (!empty($_SESSION['update_results'])) { @@ -224,7 +224,7 @@ function update_task_list($active = NULL 'finished' => 'Review log', ); - drupal_add_region_content('sidebar_first', theme('task_list', $tasks, $active)); + drupal_add_region_content('sidebar_first', theme('task_list', array('items' => $tasks, 'active' => $active))); } /** @@ -252,9 +252,9 @@ function update_check_requirements() { if ($severity == REQUIREMENT_ERROR) { update_task_list('requirements'); drupal_set_title('Requirements problem'); - $status_report = theme('status_report', $requirements); + $status_report = theme('status_report', array('requirements' => $requirements)); $status_report .= 'Please check the error messages and try again.'; - print theme('update_page', $status_report); + print theme('update_page', array('content' => $status_report)); exit(); } } @@ -363,5 +363,5 @@ else { if (isset($output) && $output) { // We defer the display of messages until all updates are done. $progress_page = ($batch = batch_get()) && isset($batch['running']); - print theme('update_page', $output, !$progress_page); + print theme('update_page', array('content' => $output, 'show_messages' => !$progress_page)); } Index: includes/batch.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/batch.inc,v retrieving revision 1.39 diff -u -p -r1.39 batch.inc --- includes/batch.inc 21 Sep 2009 07:56:07 -0000 1.39 +++ includes/batch.inc 28 Sep 2009 22:42:40 -0000 @@ -170,7 +170,7 @@ function _batch_progress_page_nojs() { // the error message. ob_start(); $fallback = $current_set['error_message'] . '
' . $batch['error_message']; - $fallback = theme('maintenance_page', $fallback, FALSE); + $fallback = theme('maintenance_page', array('content' => $fallback, 'show_messages' => FALSE)); // We strip the end of the page using a marker in the template, so any // additional HTML output by PHP shows up inside the page rather than below @@ -192,7 +192,7 @@ function _batch_progress_page_nojs() { $url = url($batch['url'], array('query' => array('id' => $batch['id'], 'op' => $new_op))); drupal_add_html_head(''); - return theme('progress_bar', $percentage, $message); + return theme('progress_bar', array('percent' => $percentage, 'message' => $message)); } /** Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.997 diff -u -p -r1.997 common.inc --- includes/common.inc 28 Sep 2009 22:22:53 -0000 1.997 +++ includes/common.inc 28 Sep 2009 22:42:40 -0000 @@ -320,7 +320,7 @@ function drupal_add_feed($url = NULL, $t $stored_feed_links = &drupal_static(__FUNCTION__, array()); if (!is_null($url) && !isset($stored_feed_links[$url])) { - $stored_feed_links[$url] = theme('feed_icon', $url, $title); + $stored_feed_links[$url] = theme('feed_icon', array('url' => $url, 'title' => $title)); drupal_add_link(array('rel' => 'alternate', 'type' => 'application/rss+xml', @@ -488,8 +488,8 @@ function drupal_site_offline() { drupal_maintenance_theme(); drupal_set_header('503 Service unavailable'); drupal_set_title(t('Site under maintenance')); - print theme('maintenance_page', filter_xss_admin(variable_get('maintenance_mode_message', - t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')))))); + print theme('maintenance_page', array('content' => filter_xss_admin(variable_get('maintenance_mode_message', + t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal'))))))); } /** @@ -1012,7 +1012,7 @@ function _drupal_log_error($error, $fata drupal_set_title(t('Error')); // We fallback to a maintenance page at this point, because the page generation // itself can generate errors. - print theme('maintenance_page', t('The website encountered an unexpected error. Please try again later.')); + print theme('maintenance_page', array('content' => t('The website encountered an unexpected error. Please try again later.'))); exit; } } @@ -1337,7 +1337,7 @@ function t($string, array $args = array( case '%': default: // Escaped and placeholder. - $args[$key] = theme('placeholder', $value); + $args[$key] = theme('placeholder', array('text' => $value)); break; case '!': @@ -3454,7 +3454,7 @@ function drupal_get_library($module, $na * themed into a table. The table must have an id attribute set. If using * theme_table(), the id may be set as such: * @code - * $output = theme('table', $header, $rows, array('id' => 'my-module-table')); + * $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'my-module-table'))); * return $output; * @endcode * @@ -4656,7 +4656,7 @@ function drupal_common_theme() { 'arguments' => array('region' => NULL), ), 'username' => array( - 'arguments' => array('object' => NULL), + 'arguments' => array('account' => NULL), ), 'progress_bar' => array( 'arguments' => array('percent' => NULL, 'message' => NULL), Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.191 diff -u -p -r1.191 file.inc --- includes/file.inc 28 Sep 2009 22:22:53 -0000 1.191 +++ includes/file.inc 28 Sep 2009 22:42:41 -0000 @@ -1162,7 +1162,7 @@ function file_save_upload($source, $vali if (!empty($errors)) { $message = t('The specified file %name could not be uploaded.', array('%name' => $file->filename)); if (count($errors) > 1) { - $message .= theme('item_list', $errors); + $message .= theme('item_list', array('items' => $errors)); } else { $message .= ' ' . array_pop($errors); Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.375 diff -u -p -r1.375 form.inc --- includes/form.inc 21 Sep 2009 06:44:13 -0000 1.375 +++ includes/form.inc 28 Sep 2009 22:42:41 -0000 @@ -1562,7 +1562,8 @@ function form_options_flatten($array, $r * $options to an associative array in which the keys are group labels, and the * values are associative arrays in the normal $options format. */ -function theme_select($element) { +function theme_select($variables) { + $element = $variables['element']; $select = ''; $size = $element['#size'] ? ' size="' . $element['#size'] . '"' : ''; _form_set_class($element, array('form-select')); @@ -1676,7 +1677,8 @@ function form_get_options($element, $key * * @ingroup themeable */ -function theme_fieldset($element) { +function theme_fieldset($variables) { + $element = $variables['element']; if (!empty($element['#collapsible'])) { if (!isset($element['#attributes']['class'])) { @@ -1705,7 +1707,8 @@ function theme_fieldset($element) { * * @ingroup themeable */ -function theme_radio($element) { +function theme_radio($variables) { + $element = $variables['element']; _form_set_class($element, array('form-radio')); $output = '' . drupal_render_children($element) . ''; } @@ -2015,7 +2020,8 @@ function form_process_text_format($eleme * * @ingroup themeable */ -function theme_text_format_wrapper($element) { +function theme_text_format_wrapper($variables) { + $element = $variables['element']; $output = '
' . "\n"; $output .= $element['#children'] . "\n"; @@ -2041,7 +2047,8 @@ function theme_text_format_wrapper($elem * * @ingroup themeable */ -function theme_checkbox($element) { +function theme_checkbox($variables) { + $element = $variables['element']; _form_set_class($element, array('form-checkbox')); $checkbox = ' $element['#empty'], 'colspan' => count($header))); } - return theme('table', $header, $rows); + return theme('table', array('header' => $header, 'rows' => $rows)); } /** @@ -2384,7 +2393,8 @@ function form_process_vertical_tabs($ele * * @ingroup themeable */ -function theme_vertical_tabs($element) { +function theme_vertical_tabs($variables) { + $element = $variables['element']; // Add required JavaScript and Stylesheet. drupal_add_library('system', 'vertical-tabs'); @@ -2402,7 +2412,8 @@ function theme_vertical_tabs($element) { * * @ingroup themeable */ -function theme_submit($element) { +function theme_submit($variables) { + $element = $variables['element']; return theme('button', $element); } @@ -2417,7 +2428,8 @@ function theme_submit($element) { * * @ingroup themeable */ -function theme_button($element) { +function theme_button($variables) { + $element = $variables['element']; $element['#attributes']['class'][] = 'form-' . $element['#button_type']; return '\n"; @@ -2433,7 +2445,8 @@ function theme_button($element) { * A themed HTML string representing the form element. * @ingroup themeable */ -function theme_image_button($element) { +function theme_image_button($variables) { + $element = $variables['element']; $element['#attributes']['class'][] = 'form-' . $element['#button_type']; return '\n"; } @@ -2472,7 +2486,8 @@ function theme_hidden($element) { * * @ingroup themeable */ -function theme_textfield($element) { +function theme_textfield($variables) { + $element = $variables['element']; $size = empty($element['#size']) ? '' : ' size="' . $element['#size'] . '"'; $maxlength = empty($element['#maxlength']) ? '' : ' maxlength="' . $element['#maxlength'] . '"'; $class = array('form-text'); @@ -2509,7 +2524,8 @@ function theme_textfield($element) { * * @ingroup themeable */ -function theme_form($element) { +function theme_form($variables) { + $element = $variables['element']; // Anonymous div to satisfy XHTML compliance. $action = $element['#action'] ? 'action="' . check_url($element['#action']) . '" ' : ''; return '
\n
" . $element['#children'] . "\n
\n"; @@ -2527,7 +2543,8 @@ function theme_form($element) { * * @ingroup themeable */ -function theme_textarea($element) { +function theme_textarea($variables) { + $element = $variables['element']; $class = array('form-textarea'); // Add resizable behavior @@ -2552,7 +2569,8 @@ function theme_textarea($element) { * @ingroup themeable */ -function theme_markup($element) { +function theme_markup($variables) { + $element = $variables['element']; return (!empty($element['#markup']) ? $element['#markup'] : '') . drupal_render_children($element); } @@ -2568,7 +2586,8 @@ function theme_markup($element) { * * @ingroup themeable */ -function theme_password($element) { +function theme_password($variables) { + $element = $variables['element']; $size = $element['#size'] ? ' size="' . $element['#size'] . '" ' : ''; $maxlength = $element['#maxlength'] ? ' maxlength="' . $element['#maxlength'] . '" ' : ''; @@ -2605,7 +2624,8 @@ function form_process_weight($element) { * For assistance with handling the uploaded file correctly, see the API * provided by file.inc. */ -function theme_file($element) { +function theme_file($variables) { + $element = $variables['element']; _form_set_class($element, array('form-file')); return '\n"; } @@ -2621,7 +2641,8 @@ function theme_file($element) { * * @ingroup themeable */ -function theme_form_element($element) { +function theme_form_element($variables) { + $element = $variables['element']; // This is also used in the installer, pre-database setup. $t = get_t(); @@ -2936,7 +2957,7 @@ function batch_process($redirect = NULL, $batch =& batch_get(); drupal_theme_initialize(); - + if (isset($batch)) { // Add process information $url = isset($url) ? $url : 'batch'; Index: includes/locale.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/locale.inc,v retrieving revision 1.228 diff -u -p -r1.228 locale.inc --- includes/locale.inc 21 Sep 2009 07:56:07 -0000 1.228 +++ includes/locale.inc 28 Sep 2009 22:42:41 -0000 @@ -71,7 +71,8 @@ function locale_languages_overview_form( * * @ingroup themeable */ -function theme_locale_languages_overview_form($form) { +function theme_locale_languages_overview_form($variables) { + $form = $variables['form']; $default = language_default(); foreach ($form['name'] as $key => $element) { // Do not take form control structures. @@ -96,7 +97,7 @@ function theme_locale_languages_overview } } $header = array(array('data' => t('English name')), array('data' => t('Native name')), array('data' => t('Code')), array('data' => t('Direction')), array('data' => t('Enabled')), array('data' => t('Default')), array('data' => t('Weight')), array('data' => t('Operations'))); - $output = theme('table', $header, $rows, array('id' => 'language-order')); + $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'language-order'))); $output .= drupal_render_children($form); drupal_add_tabledrag('language-order', 'order', 'sibling', 'language-order-weight'); @@ -543,7 +544,7 @@ function locale_translate_overview_scree $rows[$data->language][$data->textgroup] = $data->translation . '/' . $groupsums[$data->textgroup] . " ($ratio%)"; } - return theme('table', $headers, $rows); + return theme('table', array('header' => $headers, 'rows' => $rows)); } /** * @} End of "locale-translate-overview" @@ -2305,8 +2306,8 @@ function _locale_translate_seek() { } if (count($rows)) { - $output .= theme('table', $header, $rows); - if ($pager = theme('pager', NULL)) { + $output .= theme('table', array('header' => $header, 'rows' => $rows)); + if ($pager = theme('pager', array('tags' => NULL))) { $output .= $pager; } } Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.346 diff -u -p -r1.346 menu.inc --- includes/menu.inc 18 Sep 2009 10:54:20 -0000 1.346 +++ includes/menu.inc 28 Sep 2009 22:42:41 -0000 @@ -1304,8 +1304,8 @@ function template_preprocess_menu_tree(& * * @ingroup themeable */ -function theme_menu_tree($tree) { - return ''; +function theme_menu_tree($variables) { + return ''; } /** @@ -1316,7 +1316,8 @@ function theme_menu_tree($tree) { * * @ingroup themeable */ -function theme_menu_link(array $element) { +function theme_menu_link(array $variables) { + $element = $variables['element']; $sub_menu = ''; if ($element['#below']) { @@ -1336,8 +1337,9 @@ function theme_menu_link(array $element) * * @ingroup themeable */ -function theme_menu_local_task($link, $active = FALSE) { - return '
  • ' . l($link['title'], $link['href'], $link['localized_options']) . "
  • \n"; +function theme_menu_local_task($variables) { + $link = $variables['link']; + return '
  • ' . l($link['title'], $link['href'], $link['localized_options']) . "
  • \n"; } /** @@ -1348,7 +1350,8 @@ function theme_menu_local_task($link, $a * * @ingroup themeable */ -function theme_menu_local_action($link) { +function theme_menu_local_action($variables) { + $link = $variables['link']; return '
  • ' . l($link['title'], $link['href'], $link['localized_options']) . "
  • \n"; } @@ -1383,7 +1386,7 @@ function menu_get_active_help() { // Add "more help" link on admin pages if the module provides a // standalone help page. if ($arg[0] == "admin" && user_access('access administration pages') && module_exists('help') && $function('admin/help#' . $arg[2], $empty_arg) && $help) { - $output .= theme("more_help_link", url('admin/help/' . $arg[2])); + $output .= theme("more_help_link", array('url' => url('admin/help/' . $arg[2]))); } } return $output; @@ -1559,17 +1562,17 @@ function menu_local_tasks($level = 0) { for ($p = $item['tab_parent']; $tasks[$p]['type'] == MENU_DEFAULT_LOCAL_TASK; $p = $tasks[$p]['tab_parent']); // Use the path of the parent instead. $link['href'] = $tasks[$p]['href']; - $tabs_current .= theme('menu_local_task', $link, TRUE); + $tabs_current .= theme('menu_local_task', array('link' => $link, 'active' => TRUE)); $next_path = $item['path']; $tab_count++; } else { if ($item['type'] == MENU_LOCAL_TASK) { - $tabs_current .= theme('menu_local_task', $link); + $tabs_current .= theme('menu_local_task', array('link' => $link)); $tab_count++; } else { - $actions_current .= theme('menu_local_action', $link); + $actions_current .= theme('menu_local_action', array('link' => $link)); $action_count++; } } @@ -1611,14 +1614,14 @@ function menu_local_tasks($level = 0) { } // We check for the active tab. if ($item['path'] == $path) { - $tabs_current .= theme('menu_local_task', $link, TRUE); + $tabs_current .= theme('menu_local_task', array('link' => $link, 'active' => TRUE)); $next_path = $item['tab_parent']; if (isset($tasks[$next_path])) { $next_parent = $tasks[$next_path]['tab_parent']; } } else { - $tabs_current .= theme('menu_local_task', $link); + $tabs_current .= theme('menu_local_task', array('link' => $link)); } } } Index: includes/pager.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/pager.inc,v retrieving revision 1.72 diff -u -p -r1.72 pager.inc --- includes/pager.inc 18 Sep 2009 00:04:21 -0000 1.72 +++ includes/pager.inc 28 Sep 2009 22:42:41 -0000 @@ -205,7 +205,11 @@ function pager_get_querystring() { * * @ingroup themeable */ -function theme_pager($tags = array(), $element = 0, $parameters = array(), $quantity = 9) { +function theme_pager($variables) { + extract($variables, EXTR_SKIP); + // $tags = array(), $element = 0, $parameters = array(), $quantity = 9 + // @todo remove extract() if possible and check hook_theme defaults. + global $pager_page_array, $pager_total; // Calculate various markers within this pager piece: @@ -235,10 +239,10 @@ function theme_pager($tags = array(), $e } // End of generation loop preparation. - $li_first = theme('pager_first', (isset($tags[0]) ? $tags[0] : t('« first')), $element, $parameters); - $li_previous = theme('pager_previous', (isset($tags[1]) ? $tags[1] : t('‹ previous')), $element, 1, $parameters); - $li_next = theme('pager_next', (isset($tags[3]) ? $tags[3] : t('next ›')), $element, 1, $parameters); - $li_last = theme('pager_last', (isset($tags[4]) ? $tags[4] : t('last »')), $element, $parameters); + $li_first = theme('pager_first', array('text' => (isset($tags[0]) ? $tags[0] : t('« first')), 'element' => $element, 'parameters' => $parameters)); + $li_previous = theme('pager_previous', array('text' => (isset($tags[1]) ? $tags[1] : t('‹ previous')), 'element' => $element, 'interval' => 1, 'parameters' => $parameters)); + $li_next = theme('pager_next', array('text' => (isset($tags[3]) ? $tags[3] : t('next ›')), 'element' => $element, 'interval' => 1, 'parameters' => $parameters)); + $li_last = theme('pager_last', array('text' => (isset($tags[4]) ? $tags[4] : t('last »')), 'element' => $element, 'parameters' => $parameters)); if ($pager_total[$element] > 1) { if ($li_first) { @@ -267,7 +271,7 @@ function theme_pager($tags = array(), $e if ($i < $pager_current) { $items[] = array( 'class' => array('pager-item'), - 'data' => theme('pager_previous', $i, $element, ($pager_current - $i), $parameters), + 'data' => theme('pager_previous', array('text' => $i, 'element' => $element, 'interval' => ($pager_current - $i), 'parameters' => $parameters)), ); } if ($i == $pager_current) { @@ -279,7 +283,7 @@ function theme_pager($tags = array(), $e if ($i > $pager_current) { $items[] = array( 'class' => array('pager-item'), - 'data' => theme('pager_next', $i, $element, ($i - $pager_current), $parameters), + 'data' => theme('pager_next', array('text' => $i, 'element' => $element, 'interval' => ($i - $pager_current), 'parameters' => $parameters)), ); } } @@ -303,7 +307,7 @@ function theme_pager($tags = array(), $e 'data' => $li_last, ); } - return theme('item_list', $items, NULL, 'ul', array('class' => array('pager'))); + return theme('item_list', array('items' => $items, 'title' => NULL, 'type' => 'ul', 'attributes' => array('class' => array('pager')))); } } @@ -329,13 +333,17 @@ function theme_pager($tags = array(), $e * * @ingroup themeable */ -function theme_pager_first($text, $element = 0, $parameters = array()) { +function theme_pager_first($variables) { + extract($variables, EXTR_SKIP); + // $text, $element = 0, $parameters = array() + // @todo remove extract() if possible and check hook_theme defaults. + global $pager_page_array; $output = ''; // If we are anywhere but the first page if ($pager_page_array[$element] > 0) { - $output = theme('pager_link', $text, pager_load_array(0, $element, $pager_page_array), $element, $parameters); + $output = theme('pager_link', array('text' => $text, 'page_new' => pager_load_array(0, $element, $pager_page_array), 'element' => $element, 'parameters' => $parameters)); } return $output; @@ -357,7 +365,11 @@ function theme_pager_first($text, $eleme * * @ingroup themeable */ -function theme_pager_previous($text, $element = 0, $interval = 1, $parameters = array()) { +function theme_pager_previous($variables) { + extract($variables, EXTR_SKIP); + // $text, $element = 0, $interval = 1, $parameters = array() + // @todo remove extract() if possible and check hook_theme defaults. + global $pager_page_array; $output = ''; @@ -367,11 +379,11 @@ function theme_pager_previous($text, $el // If the previous page is the first page, mark the link as such. if ($page_new[$element] == 0) { - $output = theme('pager_first', $text, $element, $parameters); + $output = theme('pager_first', array('text' => $text, 'element' => $element, 'parameters' => $parameters)); } // The previous page is not the first page. else { - $output = theme('pager_link', $text, $page_new, $element, $parameters); + $output = theme('pager_link', array('text' => $text, 'page_new' => $page_new, 'element' => $element, 'parameters' => $parameters)); } } @@ -394,7 +406,11 @@ function theme_pager_previous($text, $el * * @ingroup themeable */ -function theme_pager_next($text, $element = 0, $interval = 1, $parameters = array()) { +function theme_pager_next($variables) { + extract($variables, EXTR_SKIP); + // $text, $element = 0, $interval = 1, $parameters = array() + // @todo remove extract() if possible and check hook_theme defaults. + global $pager_page_array, $pager_total; $output = ''; @@ -403,11 +419,11 @@ function theme_pager_next($text, $elemen $page_new = pager_load_array($pager_page_array[$element] + $interval, $element, $pager_page_array); // If the next page is the last page, mark the link as such. if ($page_new[$element] == ($pager_total[$element] - 1)) { - $output = theme('pager_last', $text, $element, $parameters); + $output = theme('pager_last', array('text' => $text, 'element' => $element, 'parameters' => $parameters)); } // The next page is not the last page. else { - $output = theme('pager_link', $text, $page_new, $element, $parameters); + $output = theme('pager_link', array('text' => $text, 'page_new' => $page_new, 'element' => $element, 'parameters' => $parameters)); } } @@ -428,13 +444,17 @@ function theme_pager_next($text, $elemen * * @ingroup themeable */ -function theme_pager_last($text, $element = 0, $parameters = array()) { +function theme_pager_last($variables) { + extract($variables, EXTR_SKIP); + // $text, $element = 0, $parameters = array() + // @todo remove extract() if possible and check hook_theme defaults. + global $pager_page_array, $pager_total; $output = ''; // If we are anywhere but the last page if ($pager_page_array[$element] < ($pager_total[$element] - 1)) { - $output = theme('pager_link', $text, pager_load_array($pager_total[$element] - 1, $element, $pager_page_array), $element, $parameters); + $output = theme('pager_link', array('text' => $text, 'page_new' => pager_load_array($pager_total[$element] - 1, $element, $pager_page_array), 'element' => $element, 'parameters' => $parameters)); } return $output; @@ -457,7 +477,11 @@ function theme_pager_last($text, $elemen * * @ingroup themeable */ -function theme_pager_link($text, $page_new, $element, $parameters = array(), $attributes = array()) { +function theme_pager_link($variables) { + extract($variables, EXTR_SKIP); + // $text, $page_new, $element, $parameters = array(), $attributes = array() + // @todo remove extract() if possible and check hook_theme defaults. + $page = isset($_GET['page']) ? $_GET['page'] : ''; if ($new_page = implode(',', pager_load_array($page_new[$element], $element, explode(',', $page)))) { $parameters['page'] = $new_page; Index: includes/tablesort.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/tablesort.inc,v retrieving revision 1.54 diff -u -p -r1.54 tablesort.inc --- includes/tablesort.inc 18 Sep 2009 00:04:21 -0000 1.54 +++ includes/tablesort.inc 28 Sep 2009 22:42:41 -0000 @@ -167,7 +167,7 @@ function tablesort_header($cell, $header if ($cell['data'] == $ts['name']) { $ts['sort'] = (($ts['sort'] == 'asc') ? 'desc' : 'asc'); $cell['class'][] = 'active'; - $image = theme('tablesort_indicator', $ts['sort']); + $image = theme('tablesort_indicator', array('style' => $ts['sort'])); } else { // If the user clicks a different header, we want to sort ascending initially. Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.526 diff -u -p -r1.526 theme.inc --- includes/theme.inc 21 Sep 2009 06:36:54 -0000 1.526 +++ includes/theme.inc 28 Sep 2009 22:42:41 -0000 @@ -731,10 +731,7 @@ function list_themes($refresh = FALSE) { * @return * An HTML string that generates the themed output. */ -function theme() { - $args = func_get_args(); - $hook = array_shift($args); - +function theme($hook, $variables = array()) { static $hooks = NULL; if (!isset($hooks)) { drupal_theme_initialize(); @@ -766,99 +763,78 @@ function theme() { include_once DRUPAL_ROOT . '/' . $include_file; } } - if (isset($info['function'])) { - // The theme call is a function. - // If a theme function that does not expect a renderable array is called - // with a renderable array as the only argument (via drupal_render), then - // we take the arguments from the properties of the renderable array. If - // missing, use hook_theme() defaults. - if (isset($args[0]) && is_array($args[0]) && isset($args[0]['#theme']) && count($info['arguments']) > 1) { - $new_args = array(); + // If a renderable array is passed as $variables, then set $variables to + // what's expected by the theme hook. If the theme hook expects a single + // argument, set the renderable array as that argument. If the theme hook + // expects multiple arguments, set the properties of the renderable array as + // those arguments. + if (isset($variables['#theme']) || isset($variables['#theme_wrappers'])) { + $element = $variables; + $variables = array(); + $n = count($info['arguments']); + if ($n == 1) { + $arg_keys = array_keys($info['arguments']); + $variables[$arg_keys[0]] = $element; + } + elseif ($n > 1) { foreach ($info['arguments'] as $name => $default) { - $new_args[] = isset($args[0]["#$name"]) ? $args[0]["#$name"] : $default; + if (isset($element["#$name"])) { + $variables[$name] = $element["#$name"]; + } } - $args = $new_args; } + } - // Invoke the variable processors, if any. - // We minimize the overhead for theming hooks that have no processors and - // are called many times per page request by caching '_no_processors'. If - // we do have processors, then the overhead of calling them overshadows the - // overhead of calling empty(). - if (!isset($info['_no_processors'])) { - if (!empty($info['preprocess functions']) || !empty($info['process functions'])) { - $variables = array( - 'theme_functions' => array(), - ); - if (!empty($info['arguments'])) { - $count = 0; - foreach ($info['arguments'] as $name => $default) { - $variables[$name] = isset($args[$count]) ? $args[$count] : $default; - $count++; - } - } - // We don't want a poorly behaved process function changing $hook. - $hook_clone = $hook; - foreach (array('preprocess functions', 'process functions') as $phase) { - if (!empty($info[$phase])) { - foreach ($info[$phase] as $processor_function) { - if (function_exists($processor_function)) { - $processor_function($variables, $hook_clone); - } - } - } - } - if (!empty($info['arguments'])) { - $count = 0; - foreach ($info['arguments'] as $name => $default) { - $args[$count] = $variables[$name]; - $count++; - } - } + // Merge in argument defaults. + if (!empty($info['arguments'])) { + $variables += $info['arguments']; + } - // Get suggestions for alternate functions out of the variables that - // were set. This lets us dynamically choose a function from a list. - // The order is FILO, so this array is ordered from least appropriate - // functions to most appropriate last. - $suggestions = array(); - if (isset($variables['theme_functions'])) { - $suggestions = $variables['theme_functions']; - } - if (isset($variables['theme_function'])) { - $suggestions[] = $variables['theme_function']; - } - foreach (array_reverse($suggestions) as $suggestion) { - if (function_exists($suggestion)) { - $info['function'] = $suggestion; - break; + // Invoke the variable processors, if any. The processors may specify + // alternate suggestions for which function/template should be used. + if (isset($info['preprocess functions']) || isset($info['process functions'])) { + $variables['theme_functions'] = array(); + $variables['template_files'] = array(); + foreach (array('preprocess functions', 'process functions') as $phase) { + if (!empty($info[$phase])) { + foreach ($info[$phase] as $processor_function) { + if (function_exists($processor_function)) { + // We don't want a poorly behaved process function changing $hook. + $hook_clone = $hook; + $processor_function($variables, $hook_clone); } } } - else { - $hooks[$hook]['_no_processors'] = TRUE; + } + // Function suggestion takes priority over template suggestion. + // theme_function takes priority over theme_functions. + // theme_functions are in FILO order (least appropriate to most appropriate). + // Here, just look for function suggestions. Deal with template + // suggestions only after determining that the theme call is a template. + $suggestions = array(); + if (!empty($variables['theme_functions'])) { + $suggestions = $variables['theme_functions']; + } + if (!empty($variables['theme_function'])) { + $suggestions[] = $variables['theme_function']; + } + foreach (array_reverse($suggestions) as $suggestion) { + if (function_exists($suggestion)) { + $info['function'] = $suggestion; + break; } } + } - // Call the function. + // Generate the output using either a function or a template. + if (isset($info['function'])) { if (function_exists($info['function'])) { - $output = call_user_func_array($info['function'], $args); + $output = $info['function']($variables); } } else { - // The theme call is a template. - $variables = array( - 'template_files' => array() - ); - if (!empty($info['arguments'])) { - $count = 0; - foreach ($info['arguments'] as $name => $default) { - $variables[$name] = isset($args[$count]) ? $args[$count] : $default; - $count++; - } - } - - // default render function and extension. + // Default render function and extension. $render_function = 'theme_render_template'; $extension = '.tpl.php'; @@ -878,44 +854,32 @@ function theme() { } } - // This construct ensures that we can keep a reference through - // call_user_func_array. - $args = array(&$variables, $hook); - foreach (array('preprocess functions', 'process functions') as $phase) { - if (!empty($info[$phase])) { - foreach ($info[$phase] as $processor_function) { - if (function_exists($processor_function)) { - call_user_func_array($processor_function, $args); - } - } - } - } - - // Get suggestions for alternate templates out of the variables - // that were set. This lets us dynamically choose a template - // from a list. The order is FILO, so this array is ordered from - // least appropriate first to most appropriate last. + // Find which template file exists and can be used. Priority order is: + // 1. $variables['template_file']. + // 2. $variables['template_files'] in FILO order (later in array is higher + // priority). + // 3. $info['template']. $suggestions = array(); - if (isset($variables['template_files'])) { $suggestions = $variables['template_files']; } if (isset($variables['template_file'])) { $suggestions[] = $variables['template_file']; } - if ($suggestions) { $template_file = drupal_discover_template($info['theme paths'], $suggestions, $extension); } - if (empty($template_file)) { $template_file = $info['template'] . $extension; if (isset($info['path'])) { $template_file = $info['path'] . '/' . $template_file; } } + + // Render the output using the found template file. $output = $render_function($template_file, $variables); } + // restore path_to_theme() $theme_path = $temp; return $output; @@ -1268,11 +1232,12 @@ function theme_render_template($template * * Inside Drupal, the theme layer is utilized by the use of the theme() * function, which is passed the name of a component (the theme hook) - * and several arguments. For example, theme('table', $header, $rows); + * and an array of variables. For example, + * theme('table', array('header' => $header, 'rows' => $rows)); * Additionally, the theme() function can take an array of theme * hooks, which can be used to provide 'fallback' implementations to * allow for more specific control of output. For example, the function: - * theme(array('table__foo', 'table'), $header, $rows) would look to see if + * theme(array('table__foo', 'table'), $variables) would look to see if * 'table__foo' is registered anywhere; if it is not, it would 'fall back' * to the generic 'table' implementation. This can be used to attach specific * theme functions to named objects, allowing the themer more control over @@ -1329,8 +1294,9 @@ function theme_render_template($template * @return * The formatted text (html). */ -function theme_placeholder($text) { - return '' . check_plain($text) . ''; +function theme_placeholder($variables) { + // @todo - sanitize text in a preprocess function. + return '' . check_plain($variables['text']) . ''; } /** @@ -1346,7 +1312,8 @@ function theme_placeholder($text) { * @return * A string containing the messages. */ -function theme_status_messages($display = NULL) { +function theme_status_messages($variables) { + $display = isset($variables['display']) ? $variables['display'] : NULL; $output = ''; $status_heading = array( 'status' => t('Status message'), @@ -1403,7 +1370,10 @@ function theme_status_messages($display * @return * A string containing an unordered list of links. */ -function theme_links($links, $attributes = array('class' => array('links')), $heading = array()) { +function theme_links($variables) { + extract($variables, EXTR_SKIP); + // Extracts $links, $attributes, $heading. + // @todo remove extract() if possible and check hook_theme defaults. global $language; $output = ''; @@ -1492,7 +1462,10 @@ function theme_links($links, $attributes * @return * A string containing the image tag. */ -function theme_image($path, $alt = '', $title = '', $attributes = array(), $getsize = TRUE) { +function theme_image($variables) { + extract($variables, EXTR_SKIP); + // $path, $alt = '', $title = '', $attributes = array(), $getsize = TRUE + // @todo remove extract() if possible and check hook_theme defaults. if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path)))) { $attributes = drupal_attributes($attributes); $url = file_create_url($path); @@ -1507,7 +1480,8 @@ function theme_image($path, $alt = '', $ * An array containing the breadcrumb links. * @return a string containing the breadcrumb output. */ -function theme_breadcrumb($breadcrumb) { +function theme_breadcrumb($variables) { + $breadcrumb = $variables['breadcrumb']; if (!empty($breadcrumb)) { // Provide a navigational heading to give context for breadcrumb links to // screen-reader users. Make the heading invisible with .element-invisible. @@ -1524,7 +1498,8 @@ function theme_breadcrumb($breadcrumb) { * @param $links * An array of links. */ -function theme_submenu($links) { +function theme_submenu($variables) { + $links = $variables['links']; return ''; } @@ -1603,7 +1578,13 @@ function theme_submenu($links) { * @return * An HTML string representing the table. */ -function theme_table($header, $rows, $attributes = array(), $caption = NULL, $colgroups = array(), $sticky = TRUE) { +function theme_table($variables) { + $header = $variables['header']; + $rows = $variables['rows']; + $attributes = $variables['attributes']; + $caption = $variables['caption']; + $colgroups = $variables['colgroups']; + $sticky = $variables['sticky']; // Add sticky headers, if applicable. if (count($header) && $sticky) { @@ -1732,12 +1713,12 @@ function theme_table_select_header_cell( * @return * A themed sort icon. */ -function theme_tablesort_indicator($style) { - if ($style == "asc") { - return theme('image', 'misc/arrow-asc.png', t('sort icon'), t('sort ascending')); +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', 'misc/arrow-desc.png', t('sort icon'), t('sort descending')); + return theme('image', array('path' => 'misc/arrow-desc.png', 'alt' => t('sort icon'), 'title' => t('sort descending'))); } } @@ -1751,7 +1732,8 @@ function theme_tablesort_indicator($styl * @return * A string containing the marker. */ -function theme_mark($type = MARK_NEW) { +function theme_mark($variables) { + $type = $variables['type']; global $user; if ($user->uid) { if ($type == MARK_NEW) { @@ -1781,7 +1763,10 @@ function theme_mark($type = MARK_NEW) { * @return * A string containing the list output. */ -function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = array()) { +function theme_item_list($variables) { + extract($variables, EXTR_SKIP); + // $items = array(), $title = NULL, $type = 'ul', $attributes = array() + // @todo remove extract() if possible and check hook_theme defaults. $output = '
    '; if (isset($title)) { $output .= '

    ' . $title . '

    '; @@ -1829,8 +1814,8 @@ function theme_item_list($items = array( /** * Returns code that emits the 'more help'-link. */ -function theme_more_help_link($url) { - return ''; +function theme_more_help_link($variables) { + return ''; } /** @@ -1841,10 +1826,10 @@ function theme_more_help_link($url) { * @param $title * A descriptive title of the feed. */ -function theme_feed_icon($url, $title) { - $text = t('Subscribe to @feed-title', array('@feed-title' => $title)); - if ($image = theme('image', 'misc/feed.png', $text)) { - return '' . $image . ''; +function theme_feed_icon($variables) { + $text = t('Subscribe to @feed-title', array('@feed-title' => $variables['title'])); + if ($image = theme('image', array('path' => 'misc/feed.png', 'alt' => $text))) { + return '' . $image . ''; } } @@ -1856,65 +1841,62 @@ function theme_feed_icon($url, $title) { * @param $title * A descriptive verb for the link, like 'Read more' */ -function theme_more_link($url, $title) { - return ''; +function theme_more_link($variables) { + return ''; } /** * Preprocess variables for theme_username(). * - * Modules that make any changes to the $variables['object'] properties like - * 'name' or 'extra' must insure that the final string is safe to include - * directly in the ouput by using check_plain() or filter_xss(). + * Modules that make any changes to variables like 'name' or 'extra' must insure + * that the final string is safe to include directly in the ouput by using + * check_plain() or filter_xss(). * * @see theme_username(). */ function template_preprocess_username(&$variables) { - $account = $variables['object']; - // Create a new empty object to populate with standardized data. - $variables['object'] = new stdClass; - // Keep a reference to the original data. - $variables['object']->account = $account; - $variables['object']->extra = ''; + $account = $variables['account']; + + $variables['extra'] = ''; if (empty($account->uid)) { - $variables['object']->uid = 0; - if (theme_get_setting('toggle_comment_user_verification')) { - $variables['object']->extra = ' (' . t('not verified') . ')'; - } + $variables['uid'] = 0; + if (theme_get_setting('toggle_comment_user_verification')) { + $variables['extra'] = ' (' . t('not verified') . ')'; + } } else { - $variables['object']->uid = (int)$account->uid; + $variables['uid'] = (int)$account->uid; } if (empty($account->name)) { - $variables['object']->name = variable_get('anonymous', t('Anonymous')); + $variables['name'] = variable_get('anonymous', t('Anonymous')); } else { - $variables['object']->name = $account->name; + $variables['name'] = $account->name; } - $variables['object']->profile_access = user_access('access user profiles'); - $variables['object']->link_attributes = array(); + $variables['profile_access'] = user_access('access user profiles'); + $variables['link_attributes'] = array(); // Populate link path and attributes if appropriate. - if ($variables['object']->uid && $variables['object']->profile_access) { + if ($variables['uid'] && $variables['profile_access']) { // We are linking to a local user. - $variables['object']->link_attributes = array('title' => t('View user profile.')); - $variables['object']->link_path = 'user/' . $variables['object']->uid; + $variables['link_attributes'] = array('title' => t('View user profile.')); + $variables['link_path'] = 'user/' . $variables['uid']; } elseif (!empty($account->homepage)) { - $variables['object']->link_attributes = array('rel' => 'nofollow'); - $variables['object']->link_path = $account->homepage; - $variables['object']->homepage = $account->homepage; + $variables['link_attributes'] = array('rel' => 'nofollow'); + $variables['link_path'] = $account->homepage; + $variables['homepage'] = $account->homepage; } // We do not want the l() function to check_plain() a second time. - $variables['object']->link_options['html'] = TRUE; + $variables['link_options']['html'] = TRUE; // Set a default class. - $variables['object']->attributes = array('class' => array('username')); + $variables['attributes_array'] = array('class' => array('username')); // Shorten the name when it is too long or it will break many tables. - if (drupal_strlen($variables['object']->name) > 20) { - $variables['object']->name = drupal_substr($variables['object']->name, 0, 15) . '...'; + if (drupal_strlen($variables['name']) > 20) { + $variables['name'] = drupal_substr($variables['name'], 0, 15) . '...'; } // Make sure name is safe for use in the theme function. - $variables['object']->name = check_plain($variables['object']->name); + $variables['name'] = check_plain($variables['name']); } /** @@ -1926,8 +1908,8 @@ function template_process_username(&$var // Finalize the link_options array for passing to the l() function. // This is done in the process phase so that attributes may be added by // modules or the theme during the preprocess phase. - if (isset($variables['object']->link_path)) { - $variables['object']->link_options['attributes'] = $variables['object']->link_attributes + $variables['object']->attributes; + if (isset($variables['link_path'])) { + $variables['link_options']['attributes'] = $variables['link_attributes'] + $variables['attributes_array']; } } @@ -1946,18 +1928,18 @@ function template_process_username(&$var * @see template_preprocess_username() * @see template_process_username() */ -function theme_username($object) { - if (isset($object->link_path)) { +function theme_username($variables) { + if (isset($variables['link_path'])) { // We have a link path, so we should generate a link using l(). // Additional classes may be added as array elements like - // $object->link_options['attributes']['class'][] = 'myclass'; - $output = l($object->name . $object->extra, $object->link_path, $object->link_options); + // $variables['link_options']['attributes']['class'][] = 'myclass'; + $output = l($variables['name'] . $variables['extra'], $variables['link_path'], $variables['link_options']); } else { // Modules may have added important attributes so they must be included // in the output. Additional classes may be added as array elements like - // $object->attributes['class'][] = 'myclass'; - $output = 'attributes) . '>' . $object->name . $object->extra . ''; + // $variables['attributes_array']['class'][] = 'myclass'; + $output = '' . $variables['name'] . $variables['extra'] . ''; } return $output; } @@ -1972,11 +1954,11 @@ function theme_username($object) { * @return * A themed HTML string representing the progress bar. */ -function theme_progress_bar($percent, $message) { +function theme_progress_bar($variables) { $output = '
    '; - $output .= '
    '; - $output .= '
    ' . $percent . '%
    '; - $output .= '
    ' . $message . '
    '; + $output .= '
    '; + $output .= '
    ' . $variables['percent'] . '%
    '; + $output .= '
    ' . $variables['message'] . '
    '; $output .= '
    '; return $output; @@ -1990,9 +1972,9 @@ function theme_progress_bar($percent, $m * @return * A string containing indentations. */ -function theme_indentation($size = 1) { +function theme_indentation($variables) { $output = ''; - for ($n = 0; $n < $size; $n++) { + for ($n = 0; $n < $variables['size']; $n++) { $output .= '
     
    '; } return $output; @@ -2108,7 +2090,7 @@ function template_preprocess_html(&$vari else { $variables['classes_array'][] = 'no-sidebars'; } - + // Populate the body classes. if ($suggestions = template_page_suggestions(arg(), 'page')) { foreach ($suggestions as $suggestion) { @@ -2122,7 +2104,7 @@ function template_preprocess_html(&$vari } } } - + if ($node = menu_get_object()) { $variables['classes_array'][] = 'node-type-' . form_clean_id($node->type); } @@ -2154,7 +2136,7 @@ function template_preprocess_html(&$vari } } $variables['head_title'] = implode(' | ', $head_title); - + // Populate the page template suggestions. if ($suggestions = template_page_suggestions(arg(), 'html')) { $variables['template_files'] = $suggestions; @@ -2199,7 +2181,7 @@ function template_preprocess_page(&$vari $variables['base_path'] = base_path(); $variables['front_page'] = url(); - $variables['breadcrumb'] = theme('breadcrumb', drupal_get_breadcrumb()); + $variables['breadcrumb'] = theme('breadcrumb', array('breadcrumb' => drupal_get_breadcrumb())); $variables['feed_icons'] = drupal_get_feeds(); $variables['language'] = $GLOBALS['language']; $variables['language']->dir = $GLOBALS['language']->direction ? 'rtl' : 'ltr'; Index: includes/theme.maintenance.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.maintenance.inc,v retrieving revision 1.40 diff -u -p -r1.40 theme.maintenance.inc --- includes/theme.maintenance.inc 11 Sep 2009 13:56:56 -0000 1.40 +++ includes/theme.maintenance.inc 28 Sep 2009 22:42:41 -0000 @@ -85,7 +85,8 @@ function _theme_load_offline_registry($t * * @ingroup themeable */ -function theme_task_list($items, $active = NULL) { +function theme_task_list($variables) { + extract($variables, EXTR_SKIP); $done = isset($items[$active]) || $active == NULL; $output = '

    Installation tasks

    '; $output .= '
      '; @@ -118,11 +119,9 @@ function theme_task_list($items, $active * @param $content * The page content to show. */ -function theme_install_page($content) { +function theme_install_page($variables) { drupal_set_header('Content-Type', 'text/html; charset=utf-8'); - // Assign content. - $variables['content'] = $content; // Delay setting the message variable so it can be processed below. $variables['show_messages'] = FALSE; // Variable processors invoked manually since this function and theme_update_page() @@ -136,7 +135,7 @@ function theme_install_page($content) { if (isset($messages['error'])) { $title = count($messages['error']) > 1 ? st('The following errors must be resolved before you can continue the installation process') : st('The following error must be resolved before you can continue the installation process'); $variables['messages'] .= '

      ' . $title . ':

      '; - $variables['messages'] .= theme('status_messages', 'error'); + $variables['messages'] .= theme('status_messages', array('display' => 'error')); $variables['content'] .= '

      ' . st('Please check the error messages and try again.', array('!url' => request_uri())) . '

      '; } @@ -144,14 +143,14 @@ function theme_install_page($content) { if (isset($messages['warning'])) { $title = count($messages['warning']) > 1 ? st('The following installation warnings should be carefully reviewed') : st('The following installation warning should be carefully reviewed'); $variables['messages'] .= '

      ' . $title . ':

      '; - $variables['messages'] .= theme('status_messages', 'warning'); + $variables['messages'] .= theme('status_messages', array('display' => 'warning')); } // Special handling of status messages if (isset($messages['status'])) { $title = count($messages['status']) > 1 ? st('The following installation warnings should be carefully reviewed, but in most cases may be safely ignored') : st('The following installation warning should be carefully reviewed, but in most cases may be safely ignored'); $variables['messages'] .= '

      ' . $title . ':

      '; - $variables['messages'] .= theme('status_messages', 'status'); + $variables['messages'] .= theme('status_messages', array('display' => 'status')); } // This was called as a theme hook (not template), so we need to @@ -174,13 +173,10 @@ function theme_install_page($content) { * Whether to output status and error messages. * FALSE can be useful to postpone the messages to a subsequent page. */ -function theme_update_page($content, $show_messages = TRUE) { +function theme_update_page($variables) { // Set required headers. drupal_set_header('Content-Type', 'text/html; charset=utf-8'); - // Assign content and show message flag. - $variables['content'] = $content; - $variables['show_messages'] = $show_messages; // Variable processors invoked manually since this function and theme_install_page() // are exceptions in how it works within the theme system. template_preprocess($variables, 'update_page'); @@ -192,7 +188,7 @@ function theme_update_page($content, $sh if (isset($messages['warning'])) { $title = count($messages['warning']) > 1 ? 'The following update warnings should be carefully reviewed before continuing' : 'The following update warning should be carefully reviewed before continuing'; $variables['messages'] .= '

      ' . $title . ':

      '; - $variables['messages'] .= theme('status_messages', 'warning'); + $variables['messages'] .= theme('status_messages', array('display' => 'warning')); } // This was called as a theme hook (not template), so we need to Index: modules/aggregator/aggregator.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.admin.inc,v retrieving revision 1.43 diff -u -p -r1.43 aggregator.admin.inc --- modules/aggregator/aggregator.admin.inc 18 Sep 2009 00:12:45 -0000 1.43 +++ modules/aggregator/aggregator.admin.inc 28 Sep 2009 22:42:41 -0000 @@ -32,7 +32,7 @@ function aggregator_view() { if (empty($rows)) { $rows[] = array(array('data' => t('No feeds available. Add feed.', array('@link' => url('admin/content/aggregator/add/feed'))), 'colspan' => '5', 'class' => array('message'))); } - $output .= theme('table', $header, $rows); + $output .= theme('table', array('header' => $header, 'rows' => $rows)); $result = db_query('SELECT c.cid, c.title, COUNT(ci.iid) as items FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid GROUP BY c.cid, c.title ORDER BY title'); @@ -46,7 +46,7 @@ function aggregator_view() { if (empty($rows)) { $rows[] = array(array('data' => t('No categories available. Add category.', array('@link' => url('admin/config/services/aggregator/add/category'))), 'colspan' => '5', 'class' => array('message'))); } - $output .= theme('table', $header, $rows); + $output .= theme('table', array('header' => $header, 'rows' => $rows)); return $output; } Index: modules/aggregator/aggregator.module =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.module,v retrieving revision 1.424 diff -u -p -r1.424 aggregator.module --- modules/aggregator/aggregator.module 25 Sep 2009 15:20:12 -0000 1.424 +++ modules/aggregator/aggregator.module 28 Sep 2009 22:42:41 -0000 @@ -390,7 +390,7 @@ function aggregator_block_view($delta = if ($feed = db_query('SELECT fid, title, block FROM {aggregator_feed} WHERE block <> 0 AND fid = :fid', array(':fid' => $id))->fetchObject()) { $block['subject'] = check_plain($feed->title); $result = db_query_range("SELECT * FROM {aggregator_item} WHERE fid = :fid ORDER BY timestamp DESC, iid DESC", 0, $feed->block, array(':fid' => $id)); - $read_more = theme('more_link', url('aggregator/sources/' . $feed->fid), t("View this feed's recent news.")); + $read_more = theme('more_link', array('url' => url('aggregator/sources/' . $feed->fid), 'title' => t("View this feed's recent news."))); } break; @@ -398,18 +398,18 @@ function aggregator_block_view($delta = if ($category = db_query('SELECT cid, title, block FROM {aggregator_category} WHERE cid = :cid', array(':cid' => $id))->fetchObject()) { $block['subject'] = check_plain($category->title); $result = db_query_range('SELECT i.* FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON ci.iid = i.iid WHERE ci.cid = :cid ORDER BY i.timestamp DESC, i.iid DESC', 0, $category->block, array(':cid' => $category->cid)); - $read_more = theme('more_link', url('aggregator/categories/' . $category->cid), t("View this category's recent news.")); + $read_more = theme('more_link', array('url' => url('aggregator/categories/' . $category->cid), 'title' => t("View this category's recent news."))); } break; } $items = array(); foreach ($result as $item) { - $items[] = theme('aggregator_block_item', $item); + $items[] = theme('aggregator_block_item', array('item' => $item)); } // Only display the block if there are items to show. if (count($items) > 0) { - $block['content'] = theme('item_list', $items) . $read_more; + $block['content'] = theme('item_list', array('items' => $items)) . $read_more; } return $block; } @@ -650,7 +650,10 @@ function aggregator_category_load($cid) * The item HTML. * @ingroup themeable */ -function theme_aggregator_block_item($item, $feed = 0) { +function theme_aggregator_block_item($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + // Display the external link to the item. return '' . check_plain($item->title) . "\n"; Index: modules/aggregator/aggregator.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.pages.inc,v retrieving revision 1.35 diff -u -p -r1.35 aggregator.pages.inc --- modules/aggregator/aggregator.pages.inc 25 Sep 2009 23:53:26 -0000 1.35 +++ modules/aggregator/aggregator.pages.inc 28 Sep 2009 22:42:41 -0000 @@ -37,7 +37,7 @@ function aggregator_page_source($arg1, $ // $arg1 is $form_state and $arg2 is $feed. Otherwise, $arg1 is $feed. $feed = is_object($arg2) ? $arg2 : $arg1; drupal_set_title($feed->title); - $feed_source = theme('aggregator_feed_source', $feed); + $feed_source = theme('aggregator_feed_source', array('feed' => $feed)); // It is safe to include the fid in the query because it's loaded from the // database by aggregator_feed_load. @@ -128,9 +128,9 @@ function _aggregator_page_list($items, $ // Assemble themed output. $output = $feed_source; foreach ($items as $item) { - $output .= theme('aggregator_item', $item); + $output .= theme('aggregator_item', array('item' => $item)); } - $output = theme('aggregator_wrapper', $output); + $output = theme('aggregator_wrapper', array('content' => $output)); } return $output; @@ -163,7 +163,7 @@ function aggregator_categorize_items($it '#tree' => TRUE, ); foreach ($items as $item) { - $form['items'][$item->iid] = array('#markup' => theme('aggregator_item', $item)); + $form['items'][$item->iid] = array('#markup' => theme('aggregator_item', array('item' => $item))); $form['categories'][$item->iid] = array(); $categories_result = db_query('SELECT c.cid, c.title, ci.iid FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid AND ci.iid = :iid', array(':iid' => $item->iid)); $selected = array(); @@ -235,7 +235,10 @@ function aggregator_categorize_items_sub * The output HTML. * @ingroup themeable */ -function theme_aggregator_categorize_items($form) { +function theme_aggregator_categorize_items($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $output = drupal_render($form['feed_source']); $rows = array(); if (!empty($form['items'])) { @@ -246,11 +249,11 @@ function theme_aggregator_categorize_ite ); } } - $output .= theme('table', array('', t('Categorize')), $rows); + $output .= theme('table', array('header' => array('', t('Categorize')), 'rows' => $rows)); $output .= drupal_render($form['submit']); $output .= drupal_render_children($form); - return theme('aggregator_wrapper', $output); + return theme('aggregator_wrapper', array('content' => $output)); } /** @@ -259,7 +262,7 @@ function theme_aggregator_categorize_ite * @see aggregator-wrapper.tpl.php */ function template_preprocess_aggregator_wrapper(&$variables) { - $variables['pager'] = theme('pager', NULL); + $variables['pager'] = theme('pager', array('tags' => NULL)); } /** @@ -306,15 +309,15 @@ function aggregator_page_sources() { if (variable_get('aggregator_summary_items', 3)) { $items = db_query_range('SELECT i.title, i.timestamp, i.link FROM {aggregator_item} i WHERE i.fid = :fid ORDER BY i.timestamp DESC', 0, variable_get('aggregator_summary_items', 3), array(':fid' => $feed->fid)); foreach ($items as $item) { - $summary_items[] = theme('aggregator_summary_item', $item); + $summary_items[] = theme('aggregator_summary_item', array('item' => $item)); } } $feed->url = url('aggregator/sources/' . $feed->fid); - $output .= theme('aggregator_summary_items', $summary_items, $feed); + $output .= theme('aggregator_summary_items', array('summary_items' => $summary_items, 'source' => $feed)); } - $output .= theme('feed_icon', url('aggregator/opml'), t('OPML feed')); + $output .= theme('feed_icon', array('url' => url('aggregator/opml'), 'title' => t('OPML feed'))); - return theme('aggregator_wrapper', $output); + return theme('aggregator_wrapper', array('content' => $output)); } /** @@ -329,14 +332,14 @@ function aggregator_page_categories() { $summary_items = array(); $items = db_query_range('SELECT i.title, i.timestamp, i.link, f.title as feed_title, f.link as feed_link FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON i.iid = ci.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE ci.cid = :cid ORDER BY i.timestamp DESC', 0, variable_get('aggregator_summary_items', 3), array(':cid' => $category->cid)); foreach ($items as $item) { - $summary_items[] = theme('aggregator_summary_item', $item); + $summary_items[] = theme('aggregator_summary_item', array('item' => $item)); } } $category->url = url('aggregator/categories/' . $category->cid); - $output .= theme('aggregator_summary_items', $summary_items, $category); + $output .= theme('aggregator_summary_items', array('summary_items' => $summary_items, 'source' => $category)); } - return theme('aggregator_wrapper', $output); + return theme('aggregator_wrapper', array('content' => $output)); } /** @@ -356,7 +359,7 @@ function aggregator_page_rss() { } $feeds = $result->fetchAll(); - return theme('aggregator_page_rss', $feeds, $category); + return theme('aggregator_page_rss', array('feeds' => $feeds, 'category' => $category)); } /** @@ -368,7 +371,10 @@ function aggregator_page_rss() { * A common category, if any, for all the feeds. * @ingroup themeable */ -function theme_aggregator_page_rss($feeds, $category = NULL) { +function theme_aggregator_page_rss($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + drupal_set_header('Content-Type', 'application/rss+xml; charset=utf-8'); $items = ''; @@ -418,7 +424,7 @@ function aggregator_page_opml($cid = NUL } $feeds = $result->fetchAll(); - return theme('aggregator_page_opml', $feeds); + return theme('aggregator_page_opml', array('feeds' => $feeds)); } /** @@ -428,7 +434,10 @@ function aggregator_page_opml($cid = NUL * An array of the feeds to theme. * @ingroup themeable */ -function theme_aggregator_page_opml($feeds) { +function theme_aggregator_page_opml($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + drupal_set_header('Content-Type', 'text/xml; charset=utf-8'); $output = "\n"; @@ -454,7 +463,7 @@ function theme_aggregator_page_opml($fee */ function template_preprocess_aggregator_summary_items(&$variables) { $variables['title'] = check_plain($variables['source']->title); - $variables['summary_list'] = theme('item_list', $variables['summary_items']); + $variables['summary_list'] = theme('item_list', array('items' => $variables['summary_items'])); $variables['source_url'] = $variables['source']->url; } @@ -486,7 +495,7 @@ function template_preprocess_aggregator_ function template_preprocess_aggregator_feed_source(&$variables) { $feed = $variables['feed']; - $variables['source_icon'] = theme('feed_icon', $feed->url, t('!title feed', array('!title' => $feed->title))); + $variables['source_icon'] = theme('feed_icon', array('url' => $feed->url, 'title' => t('!title feed', array('!title' => $feed->title)))); $variables['source_image'] = $feed->image; $variables['source_description'] = aggregator_filter_xss($feed->description); $variables['source_url'] = check_url(url($feed->link, array('absolute' => TRUE))); Index: modules/aggregator/aggregator.parser.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.parser.inc,v retrieving revision 1.4 diff -u -p -r1.4 aggregator.parser.inc --- modules/aggregator/aggregator.parser.inc 15 Jul 2009 21:32:43 -0000 1.4 +++ modules/aggregator/aggregator.parser.inc 28 Sep 2009 22:42:41 -0000 @@ -37,7 +37,7 @@ function aggregator_aggregator_parse($fe } if (!empty($image['link']) && !empty($image['url']) && !empty($image['title'])) { - $image = l(theme('image', $image['url'], $image['title']), $image['link'], array('html' => TRUE)); + $image = l(theme('image', array('path' => $image['url'], 'alt' => $image['title'])), $image['link'], array('html' => TRUE)); } else { $image = ''; @@ -168,7 +168,7 @@ function aggregator_parse_feed(&$data, $ if (empty($item['author']) && !empty($item['dc:creator'])) { $item['author'] = $item['dc:creator']; } - + $item += array('author' => '', 'description' => ''); // Store on $feed object. This is where processors will look for parsed items. Index: modules/blog/blog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blog/blog.module,v retrieving revision 1.335 diff -u -p -r1.335 blog.module --- modules/blog/blog.module 29 Aug 2009 05:46:02 -0000 1.335 +++ modules/blog/blog.module 28 Sep 2009 22:42:41 -0000 @@ -177,7 +177,7 @@ function blog_block_view($delta = '') { if ($node_title_list = node_title_list($result)) { $block['content'] = $node_title_list; - $block['content'] .= theme('more_link', url('blog'), t('Read the latest blog entries.')); + $block['content'] .= theme('more_link', array('url' => url('blog'), 'title' => t('Read the latest blog entries.'))); $block['subject'] = t('Recent blog posts'); return $block; } Index: modules/blog/blog.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/blog/blog.pages.inc,v retrieving revision 1.22 diff -u -p -r1.22 blog.pages.inc --- modules/blog/blog.pages.inc 10 Aug 2009 22:39:24 -0000 1.22 +++ modules/blog/blog.pages.inc 28 Sep 2009 22:42:42 -0000 @@ -55,7 +55,7 @@ function blog_page_user($account) { drupal_set_message(t('You have not created any blog entries.')); } else { - drupal_set_message(t('!author has not created any blog entries.', array('!author' => theme('username', $account)))); + drupal_set_message(t('!author has not created any blog entries.', array('!author' => theme('username', array('account' => $account))))); } } drupal_add_feed(url('blog/' . $account->uid . '/feed'), t('RSS - !title', array('!title' => $title))); Index: modules/book/book.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.admin.inc,v retrieving revision 1.22 diff -u -p -r1.22 book.admin.inc --- modules/book/book.admin.inc 18 Sep 2009 00:12:45 -0000 1.22 +++ modules/book/book.admin.inc 28 Sep 2009 22:42:42 -0000 @@ -24,7 +24,7 @@ function book_admin_overview() { $rows[] = array(array('data' => t('No books available.'), 'colspan' => 2)); } - return theme('table', $headers, $rows); + return theme('table', array('header' => $headers, 'rows' => $rows)); } /** @@ -221,7 +221,10 @@ function _book_admin_table_tree($tree, & * @ingroup themeable * @see book_admin_table() */ -function theme_book_admin_table($form) { +function theme_book_admin_table($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + drupal_add_tabledrag('book-outline', 'match', 'parent', 'book-plid', 'book-plid', 'book-mlid', TRUE, MENU_MAX_DEPTH - 2); drupal_add_tabledrag('book-outline', 'order', 'sibling', 'book-weight'); @@ -240,7 +243,7 @@ function theme_book_admin_table($form) { $form[$key]['weight']['#attributes']['class'] = array('book-weight'); $data = array( - theme('indentation', $form[$key]['depth']['#value'] - 2) . drupal_render($form[$key]['title']), + theme('indentation', array('size' => $form[$key]['depth']['#value'] - 2)) . drupal_render($form[$key]['title']), drupal_render($form[$key]['weight']), drupal_render($form[$key]['plid']) . drupal_render($form[$key]['mlid']), l(t('view'), $href), @@ -255,6 +258,6 @@ function theme_book_admin_table($form) { $rows[] = $row; } - return theme('table', $header, $rows, array('id' => 'book-outline')); + return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'book-outline'))); } Index: modules/book/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.module,v retrieving revision 1.515 diff -u -p -r1.515 book.module --- modules/book/book.module 22 Sep 2009 15:26:45 -0000 1.515 +++ modules/book/book.module 28 Sep 2009 22:42:42 -0000 @@ -264,7 +264,7 @@ function book_block_view($delta = '') { $tree = menu_tree_all_data($node->book['menu_name'], $node->book); // There should only be one element at the top level. $data = array_shift($tree); - $block['subject'] = theme('book_title_link', $data['link']); + $block['subject'] = theme('book_title_link', array('link' => $data['link'])); $block['content'] = ($data['below']) ? menu_tree_output($data['below']) : ''; } } @@ -305,7 +305,10 @@ function book_block_save($delta = '', $e * * @ingroup themeable */ -function theme_book_title_link($link) { +function theme_book_title_link($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $link['options']['attributes']['class'] = array('book-title'); return l($link['title'], $link['href'], $link['options']); @@ -737,7 +740,7 @@ function book_node_view($node, $build_mo if ($build_mode == 'full') { if (!empty($node->book['bid']) && empty($node->in_preview)) { $node->content['book_navigation'] = array( - '#markup' => theme('book_navigation', $node->book), + '#markup' => theme('book_navigation', array('book_link' => $node->book)), '#weight' => 100, ); } @@ -1087,7 +1090,7 @@ function book_node_export($node, $childr node_build_content($node, 'print'); $node->rendered = drupal_render($node->content); - return theme('book_node_export_html', $node, $children); + return theme('book_node_export_html', array('node' => $node, 'children' => $children)); } /** Index: modules/book/book.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.pages.inc,v retrieving revision 1.16 diff -u -p -r1.16 book.pages.inc --- modules/book/book.pages.inc 18 Sep 2009 00:12:45 -0000 1.16 +++ modules/book/book.pages.inc 28 Sep 2009 22:42:42 -0000 @@ -15,7 +15,7 @@ function book_render() { $book_list[] = l($book['title'], $book['href'], $book['options']); } - return theme('item_list', $book_list); + return theme('item_list', array('items' => $book_list)); } /** @@ -79,7 +79,7 @@ function book_export_html($nid) { $contents = book_export_traverse($tree, 'book_node_export'); } - return theme('book_export_html', $node->title, $contents, $node->book['depth']); + return theme('book_export_html', array('title' => $node->title, 'contents' => $contents, 'depth' => $node->book['depth'])); } else { drupal_access_denied(); Index: modules/color/color.module =================================================================== RCS file: /cvs/drupal/drupal/modules/color/color.module,v retrieving revision 1.72 diff -u -p -r1.72 color.module --- modules/color/color.module 18 Sep 2009 00:12:45 -0000 1.72 +++ modules/color/color.module 28 Sep 2009 22:42:42 -0000 @@ -60,7 +60,7 @@ function _color_theme_select_form_alter( foreach (element_children($form) as $theme) { if ($screenshot = variable_get('color_' . $theme . '_screenshot')) { if (isset($form[$theme]['screenshot'])) { - $form[$theme]['screenshot']['#markup'] = theme('image', $screenshot, '', '', array('class' => array('screenshot')), FALSE); + $form[$theme]['screenshot']['#markup'] = theme('image', array('path' => $screenshot, 'alt' => '', 'title' => '', 'attributes' => array('class' => array('screenshot')), 'getsize' => FALSE)); } } } @@ -207,7 +207,10 @@ function color_scheme_form($form, &$form * * @ingroup themeable */ -function theme_color_scheme_form($form) { +function theme_color_scheme_form($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $theme = $form['theme']['#value']; $info = $form['info']['#value']; $path = drupal_get_path('theme', $theme) . '/'; Index: modules/comment/comment.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.admin.inc,v retrieving revision 1.32 diff -u -p -r1.32 comment.admin.inc --- modules/comment/comment.admin.inc 18 Sep 2009 00:12:45 -0000 1.32 +++ modules/comment/comment.admin.inc 28 Sep 2009 22:42:42 -0000 @@ -87,7 +87,7 @@ function comment_admin_overview($form, & foreach ($result as $comment) { $options[$comment->cid] = array( 'subject' => l($comment->subject, 'comment/' . $comment->cid, array('attributes' => array('title' => truncate_utf8($comment->comment, 128)), 'fragment' => 'comment-' . $comment->cid)), - 'author' => theme('username', $comment), + 'author' => theme('username', array('account' => $comment)), 'posted_in' => l($comment->node_title, 'node/' . $comment->nid), 'time' => format_date($comment->timestamp, 'short'), 'operations' => l(t('edit'), 'comment/edit/' . $comment->cid, array('query' => $destination)), Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.774 diff -u -p -r1.774 comment.module --- modules/comment/comment.module 22 Sep 2009 07:36:57 -0000 1.774 +++ modules/comment/comment.module 28 Sep 2009 22:42:42 -0000 @@ -142,7 +142,7 @@ function comment_theme() { 'arguments' => array('elements' => NULL), ), 'comment_post_forbidden' => array( - 'arguments' => array('nid' => NULL), + 'arguments' => array('node' => NULL), ), 'comment_wrapper' => array( 'template' => 'comment-wrapper', @@ -466,7 +466,7 @@ function theme_comment_block() { } if ($items) { - return theme('item_list', $items); + return theme('item_list', array('items' => $items)); } } @@ -522,7 +522,7 @@ function comment_node_view($node, $build ); } else { - $links['comment_forbidden']['title'] = theme('comment_post_forbidden', $node); + $links['comment_forbidden']['title'] = theme('comment_post_forbidden', array('node' => $node)); } } } @@ -547,7 +547,7 @@ function comment_node_view($node, $build } } else { - $links['comment_forbidden']['title'] = theme('comment_post_forbidden', $node); + $links['comment_forbidden']['title'] = theme('comment_post_forbidden', array('node' => $node)); } } } @@ -901,7 +901,7 @@ function comment_links($comment, $node) ); } else { - $links['comment_forbidden']['title'] = theme('comment_post_forbidden', $node); + $links['comment_forbidden']['title'] = theme('comment_post_forbidden', array('node' => $node)); $links['comment_forbidden']['html'] = TRUE; } } @@ -1736,7 +1736,7 @@ function comment_form($form, &$form_stat $form['_author'] = array( '#type' => 'item', '#title' => t('Your name'), - '#markup' => theme('username', $user), + '#markup' => theme('username', array('account' => $user)), ); $form['author'] = array( '#type' => 'value', @@ -2093,19 +2093,19 @@ function template_preprocess_comment(&$v $node = $variables['elements']['#node']; $variables['comment'] = $comment; $variables['node'] = $node; - $variables['author'] = theme('username', $comment); + $variables['author'] = theme('username', array('account' => $comment)); $variables['date'] = format_date($comment->timestamp); $variables['new'] = !empty($comment->new) ? t('new') : ''; - $variables['picture'] = theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', $comment) : ''; + $variables['picture'] = theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', array('account' => $comment)) : ''; $variables['signature'] = $comment->signature; $variables['title'] = l($comment->subject, 'comment/' . $comment->cid, array('fragment' => "comment-$comment->cid")); $variables['template_files'][] = 'comment-' . $variables['node']->type; - + // Helpful $content variable for templates. foreach (element_children($variables['elements']) as $key) { $variables['content'][$key] = $variables['elements'][$key]; } - + // Set status to a string representation of comment->status. if (isset($comment->in_preview)) { $variables['status'] = 'comment-preview'; @@ -2141,7 +2141,10 @@ function template_preprocess_comment(&$v * The comment node. * @ingroup themeable */ -function theme_comment_post_forbidden($node) { +function theme_comment_post_forbidden($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + global $user; if (!$user->uid) { Index: modules/contact/contact.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.admin.inc,v retrieving revision 1.16 diff -u -p -r1.16 contact.admin.inc --- modules/contact/contact.admin.inc 26 Sep 2009 00:13:18 -0000 1.16 +++ modules/contact/contact.admin.inc 28 Sep 2009 22:42:42 -0000 @@ -33,7 +33,7 @@ function contact_admin_categories() { $rows[] = array(array('data' => t('No categories available. Add category.', array('@link' => url('admin/structure/contact/add'))), 'colspan' => 5)); } - return theme('table', $header, $rows); + return theme('table', array('header' => $header, 'rows' => $rows)); } /** Index: modules/contact/contact.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.pages.inc,v retrieving revision 1.25 diff -u -p -r1.25 contact.pages.inc --- modules/contact/contact.pages.inc 26 Sep 2009 00:13:19 -0000 1.25 +++ modules/contact/contact.pages.inc 28 Sep 2009 22:42:42 -0000 @@ -177,11 +177,11 @@ function contact_personal_form($form, &$ $form['recipient'] = array('#type' => 'value', '#value' => $recipient); $form['from'] = array('#type' => 'item', '#title' => t('From'), - '#markup' => theme('username', $user) . ' <' . check_plain($user->mail) . '>', + '#markup' => theme('username', array('account' => $user)) . ' <' . check_plain($user->mail) . '>', ); $form['to'] = array('#type' => 'item', '#title' => t('To'), - '#markup' => theme('username', $recipient), + '#markup' => theme('username', array('account' => $recipient)), ); $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), Index: modules/dblog/dblog.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.admin.inc,v retrieving revision 1.30 diff -u -p -r1.30 dblog.admin.inc --- modules/dblog/dblog.admin.inc 18 Sep 2009 00:12:46 -0000 1.30 +++ modules/dblog/dblog.admin.inc 28 Sep 2009 22:42:42 -0000 @@ -16,11 +16,11 @@ function dblog_overview() { WATCHDOG_DEBUG => '', WATCHDOG_INFO => '', WATCHDOG_NOTICE => '', - WATCHDOG_WARNING => theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning')), - WATCHDOG_ERROR => theme('image', 'misc/watchdog-error.png', t('error'), t('error')), - WATCHDOG_CRITICAL => theme('image', 'misc/watchdog-error.png', t('critical'), t('critical')), - WATCHDOG_ALERT => theme('image', 'misc/watchdog-error.png', t('alert'), t('alert')), - WATCHDOG_EMERG => theme('image', 'misc/watchdog-error.png', t('emergency'), t('emergency')), + WATCHDOG_WARNING => theme('image', array('path' => 'misc/watchdog-warning.png', 'alt' => t('warning'), 'title' => t('warning'))), + WATCHDOG_ERROR => theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => t('error'), 'title' => t('error'))), + WATCHDOG_CRITICAL => theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => t('critical'), 'title' => t('critical'))), + WATCHDOG_ALERT => theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => t('alert'), 'title' => t('alert'))), + WATCHDOG_EMERG => theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => t('emergency'), 'title' => t('emergency'))), ); $classes = array( WATCHDOG_DEBUG => 'dblog-debug', @@ -66,7 +66,7 @@ function dblog_overview() { t($dblog->type), format_date($dblog->timestamp, 'short'), l(truncate_utf8(_dblog_format_message($dblog), 56, TRUE, TRUE), 'admin/reports/event/' . $dblog->wid, array('html' => TRUE)), - theme('username', $dblog), + theme('username', array('account' => $dblog)), $dblog->link, ), // Attributes for tr @@ -152,7 +152,7 @@ function dblog_event($id) { ), array( array('data' => t('User'), 'header' => TRUE), - theme('username', $dblog), + theme('username', array('account' => $dblog)), ), array( array('data' => t('Location'), 'header' => TRUE), Index: modules/dblog/dblog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.module,v retrieving revision 1.42 diff -u -p -r1.42 dblog.module --- modules/dblog/dblog.module 29 Aug 2009 03:36:27 -0000 1.42 +++ modules/dblog/dblog.module 28 Sep 2009 22:42:42 -0000 @@ -173,7 +173,10 @@ function dblog_form_system_logging_setti * * @ingroup themeable */ -function theme_dblog_filters($form) { +function theme_dblog_filters($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $output = ''; foreach (element_children($form['status']) as $key) { $output .= drupal_render($form['status'][$key]); Index: modules/field/field.api.php =================================================================== RCS file: /cvs/drupal/drupal/modules/field/field.api.php,v retrieving revision 1.36 diff -u -p -r1.36 field.api.php --- modules/field/field.api.php 27 Sep 2009 12:52:55 -0000 1.36 +++ modules/field/field.api.php 28 Sep 2009 22:42:42 -0000 @@ -790,7 +790,8 @@ function hook_field_formatter_info_alter * - #formatter: The name of the formatter being used. * - #settings: The array of formatter settings. */ -function theme_field_formatter_FORMATTER_SINGLE($element) { +function theme_field_formatter_FORMATTER_SINGLE($variables) { + extract($variables, EXTR_SKIP); // This relies on a 'safe' element being prepared in hook_field_sanitize(). return $element['#item']['safe']; } @@ -812,7 +813,10 @@ function theme_field_formatter_FORMATTER * - #settings: The array of formatter settings. * - numeric indexes: the field values being displayed. */ -function theme_field_formatter_FORMATTER_MULTIPLE($element) { +function theme_field_formatter_FORMATTER_MULTIPLE($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $items = array(); foreach (element_children($element) as $key) { $items[$key] = $key .':'. $element[$key]['#item']['value']; Index: modules/field/field.form.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/field/field.form.inc,v retrieving revision 1.25 diff -u -p -r1.25 field.form.inc --- modules/field/field.form.inc 21 Sep 2009 08:54:57 -0000 1.25 +++ modules/field/field.form.inc 28 Sep 2009 22:42:42 -0000 @@ -221,7 +221,8 @@ function field_multiple_value_form($fiel * Combine multiple values into a table with drag-n-drop reordering. * TODO : convert to a template. */ -function theme_field_multiple_value_form($element) { +function theme_field_multiple_value_form($variables) { + extract($variables, EXTR_SKIP); $output = ''; if ($element['#multiple'] > 1 || $element['#multiple'] == FIELD_CARDINALITY_UNLIMITED) { @@ -268,7 +269,7 @@ function theme_field_multiple_value_form } $output = '
      '; - $output .= theme('table', $header, $rows, array('id' => $table_id, 'class' => array('field-multiple-table'))); + $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => $table_id, 'class' => array('field-multiple-table')))); $output .= $element['#description'] ? '
      ' . $element['#description'] . '
      ' : ''; $output .= '
      ' . drupal_render($add_more_button) . '
      '; $output .= '
      '; Index: modules/field/modules/list/list.module =================================================================== RCS file: /cvs/drupal/drupal/modules/field/modules/list/list.module,v retrieving revision 1.15 diff -u -p -r1.15 list.module --- modules/field/modules/list/list.module 26 Sep 2009 15:57:38 -0000 1.15 +++ modules/field/modules/list/list.module 28 Sep 2009 22:42:42 -0000 @@ -263,7 +263,8 @@ function list_field_formatter_info() { /** * Theme function for 'default' list field formatter. */ -function theme_field_formatter_list_default($element) { +function theme_field_formatter_list_default($variables) { + $element = $variables['element']; $field = field_info_field($element['#field_name']); if (($allowed_values = list_allowed_values($field)) && isset($allowed_values[$element['#item']['value']])) { return $allowed_values[$element['#item']['value']]; @@ -275,6 +276,7 @@ function theme_field_formatter_list_defa /** * Theme function for 'key' list field formatter. */ -function theme_field_formatter_list_key($element) { +function theme_field_formatter_list_key($variables) { + $element = $variables['element']; return $element['#item']['safe']; } Index: modules/field/modules/number/number.module =================================================================== RCS file: /cvs/drupal/drupal/modules/field/modules/number/number.module,v retrieving revision 1.20 diff -u -p -r1.20 number.module --- modules/field/modules/number/number.module 27 Sep 2009 11:12:15 -0000 1.20 +++ modules/field/modules/number/number.module 28 Sep 2009 22:42:42 -0000 @@ -242,14 +242,16 @@ function number_field_formatter_info() { /** * Theme function for 'unformatted' number field formatter. */ -function theme_field_formatter_number_unformatted($element) { +function theme_field_formatter_number_unformatted($variables) { + $element = $variables['element']; return $element['#item']['value']; } /** * Proxy theme function for number field formatters. */ -function theme_field_formatter_number($element) { +function theme_field_formatter_number($variables) { + $element = $variables['element']; $field = field_info_field($element['#field_name']); $instance = field_info_instance($element['#field_name'], $element['#bundle']); $value = $element['#item']['value']; @@ -499,6 +501,7 @@ function number_decimal_validate($elemen * $element['#field_name'] contains the field name * $element['#delta] is the position of this element in the group */ -function theme_number($element) { +function theme_number($variables) { + $element = $variables['element']; return $element['#children']; } Index: modules/field/modules/options/options.module =================================================================== RCS file: /cvs/drupal/drupal/modules/field/modules/options/options.module,v retrieving revision 1.10 diff -u -p -r1.10 options.module --- modules/field/modules/options/options.module 10 Sep 2009 06:31:38 -0000 1.10 +++ modules/field/modules/options/options.module 28 Sep 2009 22:42:42 -0000 @@ -21,7 +21,7 @@ function options_theme() { 'arguments' => array('element' => NULL), ), 'options_none' => array( - 'arguments' => array('widget_type' => NULL, 'field_name' => NULL, 'node_type' => NULL), + 'arguments' => array('instance' => NULL), ), ); } @@ -375,7 +375,7 @@ function options_options($field, $instan if (!$instance['required']) { if ((in_array($instance['widget']['type'], array('options_buttons', 'node_reference_buttons', 'user_reference_buttons')) && !$field['cardinality']) || (in_array($instance['widget']['type'], array('options_select', 'node_reference_select', 'user_reference_select')))) { - $options = array('' => theme('options_none', $instance)) + $options; + $options = array('' => theme('options_none', array('instance' => $instance))) + $options; } } return $options; @@ -385,7 +385,8 @@ function options_options($field, $instan * Theme the label for the empty value for options that are not required. * The default theme will display N/A for a radio list and blank for a select. */ -function theme_options_none($instance) { +function theme_options_none($variables) { + $instance = $variables['instance']; switch ($instance['widget']['type']) { case 'options_buttons': case 'node_reference_buttons': @@ -411,14 +412,17 @@ function theme_options_none($instance) { * $element['#field_name'] contains the field name * $element['#delta] is the position of this element in the group */ -function theme_options_select($element) { +function theme_options_select($variables) { + $element = $variables['element']; return $element['#children']; } -function theme_options_onoff($element) { +function theme_options_onoff($variables) { + $element = $variables['element']; return $element['#children']; } -function theme_options_buttons($element) { +function theme_options_buttons($variables) { + $element = $variables['element']; return $element['#children']; } \ No newline at end of file Index: modules/field/modules/text/text.module =================================================================== RCS file: /cvs/drupal/drupal/modules/field/modules/text/text.module,v retrieving revision 1.30 diff -u -p -r1.30 text.module --- modules/field/modules/text/text.module 26 Sep 2009 15:57:38 -0000 1.30 +++ modules/field/modules/text/text.module 28 Sep 2009 22:42:42 -0000 @@ -299,21 +299,24 @@ function text_field_formatter_info() { /** * Theme function for 'default' text field formatter. */ -function theme_field_formatter_text_default($element) { +function theme_field_formatter_text_default($variables) { + $element = $variables['element']; return $element['#item']['safe']; } /** * Theme function for 'plain' text field formatter. */ -function theme_field_formatter_text_plain($element) { +function theme_field_formatter_text_plain($variables) { + $element = $variables['element']; return strip_tags($element['#item']['safe']); } /** * Theme function for 'trimmed' text field formatter. */ -function theme_field_formatter_text_trimmed($element) { +function theme_field_formatter_text_trimmed($variables) { + $element = $variables['element']; $field = field_info_field($element['#field_name']); $instance = field_info_instance($element['#field_name'], $element['#bundle']); return text_summary($element['#item']['safe'], $instance['settings']['text_processing'] ? $element['#item']['format'] : NULL); @@ -325,7 +328,8 @@ function theme_field_formatter_text_trim * element of the field or, if the summary is empty, the trimmed * version of the full element of the field. */ -function theme_field_formatter_text_summary_or_trimmed($element) { +function theme_field_formatter_text_summary_or_trimmed($variables) { + $element = $variables['element']; $field = field_info_field($element['#field_name']); $instance = field_info_instance($element['#field_name'], $element['#bundle']); @@ -780,10 +784,12 @@ function text_field_widget_formatted_tex * $element['#field_name'] contains the field name * $element['#delta] is the position of this element in the group */ -function theme_text_textfield($element) { +function theme_text_textfield($variables) { + $element = $variables['element']; return $element['#children']; } -function theme_text_textarea($element) { +function theme_text_textarea($variables) { + $element = $variables['element']; return $element['#children']; } Index: modules/field_ui/field_ui.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/field_ui/field_ui.admin.inc,v retrieving revision 1.17 diff -u -p -r1.17 field_ui.admin.inc --- modules/field_ui/field_ui.admin.inc 26 Sep 2009 15:57:38 -0000 1.17 +++ modules/field_ui/field_ui.admin.inc 28 Sep 2009 22:42:42 -0000 @@ -34,7 +34,7 @@ function field_ui_fields_list() { else { // Sort rows by field name. ksort($rows); - $output = theme('table', $header, $rows); + $output = theme('table', array('header' => $header, 'rows' => $rows)); } return $output; } @@ -56,7 +56,7 @@ function field_ui_inactive_message($bund '%widget_module' => $instance['widget']['module'], )); } - drupal_set_message(t('Inactive fields are not shown unless their providing modules are enabled. The following fields are not enabled: !list', array('!list' => theme('item_list', $list))), 'error'); + drupal_set_message(t('Inactive fields are not shown unless their providing modules are enabled. The following fields are not enabled: !list', array('!list' => theme('item_list', array('items' => $list)))), 'error'); } } @@ -831,7 +831,7 @@ function field_ui_field_settings_form($f '#options' => array(TRUE => t('Translatable field'), FALSE => t('Language neutral field')), '#default_value' => $field['translatable'], '#description' => t("Translatable fields can have a different value for each available language. An example of a translatable field is an article's body. Language neutral fields will retain the same value across all translations. An example of a language neutral field is a user profile's first name."), - ); + ); // Add settings provided by the field module. The field module is // responsible for not returning settings that cannot be changed if Index: modules/file/file.field.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/file/file.field.inc,v retrieving revision 1.4 diff -u -p -r1.4 file.field.inc --- modules/file/file.field.inc 26 Sep 2009 15:57:38 -0000 1.4 +++ modules/file/file.field.inc 28 Sep 2009 22:42:42 -0000 @@ -523,7 +523,7 @@ function file_field_widget(&$form, &$for // If there's only one field, return it as delta 0. $element['#title'] = $instance['label']; if (empty($element['#default_value']['fid'])) { - $element['#description'] = theme('file_upload_help', $instance['description'], $element['#upload_validators']); + $element['#description'] = theme('file_upload_help', array('description' => $instance['description'], 'upload_validators' => $element['#upload_validators'])); } $elements = array($element); } @@ -557,7 +557,7 @@ function file_field_widget(&$form, &$for // field. These are added here so that they may be referenced easily through // a hook_form_alter(). $elements['#file_upload_title'] = t('Add a new file'); - $elements['#file_upload_description'] = theme('file_upload_help', '', $elements[0]['#upload_validators']); + $elements['#file_upload_description'] = theme('file_upload_help', array('description' => '', 'upload_validators' => $elements[0]['#upload_validators'])); } return $elements; @@ -746,7 +746,10 @@ function file_field_widget_process_multi /** * Theme an individual file upload widget. */ -function theme_file_widget($element) { +function theme_file_widget($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $output = ''; // The "form-managed-file" class is required for proper AJAX functionality. $output .= '
      '; @@ -763,7 +766,10 @@ function theme_file_widget($element) { /** * Theme a group of file upload widgets. */ -function theme_file_widget_multiple($element) { +function theme_file_widget_multiple($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $field = field_info_field($element['#field_name']); // Get our list of widgets in order. @@ -840,7 +846,7 @@ function theme_file_widget_multiple($ele drupal_add_tabledrag($table_id, 'order', 'sibling', $weight_class); $output = ''; - $output = empty($rows) ? '' : theme('table', $headers, $rows, array('id' => $table_id)); + $output = empty($rows) ? '' : theme('table', array('header' => $headers, 'rows' => $rows, 'attributes' => array('id' => $table_id))); $output .= drupal_render_children($element); return $output; } @@ -855,7 +861,10 @@ function theme_file_widget_multiple($ele * @return * A string suitable for a file field description. */ -function theme_file_upload_help($description, $upload_validators) { +function theme_file_upload_help($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $descriptions = array(); if (strlen($description)) { @@ -890,29 +899,38 @@ function theme_file_upload_help($descrip /** * Theme function for 'default' file field formatter. */ -function theme_field_formatter_file_default($element) { - return theme('file_link', (object) $element['#item']); +function theme_field_formatter_file_default($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + + return theme('file_link', array('file' => (object) $element['#item'])); } /** * Theme function for 'url_plain' file field formatter. */ -function theme_field_formatter_file_url_plain($element) { +function theme_field_formatter_file_url_plain($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + return empty($element['#item']['uri']) ? '' : file_create_url($element['#item']['uri']); } /** * Theme function for the 'table' formatter. */ -function theme_field_formatter_file_table($element) { +function theme_field_formatter_file_table($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $header = array(t('Attachment'), t('Size')); $rows = array(); foreach (element_children($element) as $key) { $rows[] = array( - theme('file_link', (object) $element[$key]['#item']), + theme('file_link', array('file' => (object) $element[$key]['#item'])), format_size($element[$key]['#item']['filesize']), ); } - return empty($rows) ? '' : theme('table', $header, $rows); + return empty($rows) ? '' : theme('table', array('header' => $header, 'rows' => $rows)); } Index: modules/file/file.module =================================================================== RCS file: /cvs/drupal/drupal/modules/file/file.module,v retrieving revision 1.4 diff -u -p -r1.4 file.module --- modules/file/file.module 10 Sep 2009 06:31:39 -0000 1.4 +++ modules/file/file.module 28 Sep 2009 22:42:42 -0000 @@ -80,7 +80,7 @@ function file_theme() { 'arguments' => array('element' => NULL), ), 'file_upload_help' => array( - 'arguments' => array('upload_validators' => NULL), + 'arguments' => array('description' => NULL, 'upload_validators' => NULL), ), ); } @@ -413,7 +413,7 @@ function file_managed_file_process($elem if ($fid && $element['#file']) { $element['filename'] = array( '#type' => 'markup', - '#markup' => theme('file_link', $element['#file']) . ' ', + '#markup' => theme('file_link', array('file' => $element['#file'])) . ' ', '#weight' => -10, ); } @@ -577,7 +577,10 @@ function file_managed_file_save_upload($ /** * Theme a managed file element. */ -function theme_file_managed_file($element) { +function theme_file_managed_file($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + // This wrapper is required to apply JS behaviors and CSS styling. $output = ''; $output .= '
      '; @@ -592,9 +595,12 @@ function theme_file_managed_file($elemen * @param $file * A file object to which the link will be created. */ -function theme_file_link($file) { +function theme_file_link($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $url = file_create_url($file->uri); - $icon = theme('file_icon', $file); + $icon = theme('file_icon', array('file' => $file)); // Set options as per anchor format described at // http://microformats.org/wiki/file-format-examples @@ -622,7 +628,10 @@ function theme_file_link($file) { * @param $file * A file object for which to make an icon. */ -function theme_file_icon($file) { +function theme_file_icon($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $mime = check_plain($file->filemime); $icon_url = file_icon_url($file); return ''; Index: modules/file/tests/file.test =================================================================== RCS file: /cvs/drupal/drupal/modules/file/tests/file.test,v retrieving revision 1.2 diff -u -p -r1.2 file.test --- modules/file/tests/file.test 20 Sep 2009 17:40:41 -0000 1.2 +++ modules/file/tests/file.test 28 Sep 2009 22:42:42 -0000 @@ -304,7 +304,7 @@ class FileFieldDisplayTestCase extends F // Check that the default formatter is displaying with the file name. $node = node_load($nid, NULL, TRUE); $node_file = (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0]; - $default_output = theme('file_link', $node_file); + $default_output = theme('file_link', array('file' => $node_file)); $this->assertRaw($default_output, t('Default formatter displaying correctly on full node view.')); // Turn the "display" option off and check that the file is no longer displayed. @@ -531,7 +531,7 @@ class FileFieldPathTestCase extends File /** * A loose assertion to check that a file is uploaded to the right location. - * + * * @param $expected_path * The location where the file is expected to be uploaded. Duplicate file * names to not need to be taken into account. Index: modules/filter/filter.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v retrieving revision 1.47 diff -u -p -r1.47 filter.admin.inc --- modules/filter/filter.admin.inc 25 Sep 2009 14:06:09 -0000 1.47 +++ modules/filter/filter.admin.inc 28 Sep 2009 22:42:42 -0000 @@ -23,8 +23,8 @@ function filter_admin_overview($form) { // to all roles and cannot be deleted via the admin interface. $form['formats'][$id]['#is_fallback'] = ($id == $fallback_format); if ($form['formats'][$id]['#is_fallback']) { - $form['formats'][$id]['name'] = array('#markup' => theme('placeholder', $format->name)); - $roles_markup = theme('placeholder', t('All roles may use this format')); + $form['formats'][$id]['name'] = array('#markup' => theme('placeholder', array('text' => $format->name))); + $roles_markup = theme('placeholder', array('text' => t('All roles may use this format'))); } else { $form['formats'][$id]['name'] = array('#markup' => check_plain($format->name)); @@ -59,7 +59,10 @@ function filter_admin_overview_submit($f * * @ingroup themeable */ -function theme_filter_admin_overview($form) { +function theme_filter_admin_overview($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $rows = array(); foreach (element_children($form['formats']) as $id) { $form['formats'][$id]['weight']['#attributes']['class'] = array('text-format-order-weight'); @@ -75,7 +78,7 @@ function theme_filter_admin_overview($fo ); } $header = array(t('Name'), t('Roles'), t('Weight'), array('data' => t('Operations'), 'colspan' => 2)); - $output = theme('table', $header, $rows, array('id' => 'text-format-order')); + $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'text-format-order'))); $output .= drupal_render_children($form); drupal_add_tabledrag('text-format-order', 'order', 'sibling', 'text-format-order-weight'); @@ -153,7 +156,7 @@ function filter_admin_format_form($form, // Composition tips (guidelines) $tips = _filter_tips($format->format, FALSE); - $tiplist = theme('filter_tips', $tips, FALSE); + $tiplist = theme('filter_tips', array('tips' => $tips, 'long' => FALSE)); if (!$tiplist) { $tiplist = '

      ' . t('No guidelines available.') . '

      '; } @@ -342,7 +345,10 @@ function filter_admin_order($form, &$for * * @ingroup themeable */ -function theme_filter_admin_order($form) { +function theme_filter_admin_order($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $header = array(t('Name'), t('Weight')); $rows = array(); foreach (element_children($form['names']) as $id) { @@ -356,7 +362,7 @@ function theme_filter_admin_order($form) } } - $output = theme('table', $header, $rows, array('id' => 'filter-order')); + $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'filter-order'))); $output .= drupal_render_children($form); drupal_add_tabledrag('filter-order', 'order', 'sibling', 'filter-order-weight', NULL, NULL, FALSE); Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.291 diff -u -p -r1.291 filter.module --- modules/filter/filter.module 20 Sep 2009 07:32:18 -0000 1.291 +++ modules/filter/filter.module 28 Sep 2009 22:42:42 -0000 @@ -265,7 +265,7 @@ function filter_permission() { if (!empty($permission)) { // Only link to the text format configuration page if the user who is // viewing this will have access to that page. - $format_name_replacement = user_access('administer filters') ? l($format->name, 'admin/config/content/formats/' . $format->format) : theme('placeholder', $format->name); + $format_name_replacement = user_access('administer filters') ? l($format->name, 'admin/config/content/formats/' . $format->format) : theme('placeholder', array('text' => $format->name)); $perms[$permission] = array( 'title' => t("Use the %text_format text format", array('%text_format' => $format->name)), 'description' => t('Use !text_format in forms when entering or editing content. %warning', array('!text_format' => $format_name_replacement, '%warning' => t('Warning: This permission may have security implications depending on how the text format is configured.'))), @@ -371,7 +371,7 @@ function _filter_html_tips($filter, $for ); } } - $output .= theme('table', $header, $rows); + $output .= theme('table', array('header' => $header, 'rows' => $rows)); $output .= '

      ' . t('Most unusual characters can be directly entered without any problems.') . '

      '; $output .= '

      ' . t('If you do encounter problems, try using HTML character entities. A common example looks like &amp; for an ampersand & character. For a full list of entities see HTML\'s entities page. Some of the available characters include:', array('@html-entities' => 'http://www.w3.org/TR/html4/sgml/entities.html')) . '

      '; @@ -391,7 +391,7 @@ function _filter_html_tips($filter, $for array('data' => $entity[1], 'class' => array('get')) ); } - $output .= theme('table', $header, $rows); + $output .= theme('table', array('header' => $header, 'rows' => $rows)); return $output; } @@ -761,7 +761,7 @@ function filter_form($selected_format = foreach ($formats as $format) { $options[$format->format] = $format->name; $form['format_guidelines'][$format->format] = array( - '#markup' => theme('filter_guidelines', $format), + '#markup' => theme('filter_guidelines', array('format' => $format)), ); } $form['format'] = array( @@ -906,9 +906,12 @@ function theme_filter_tips_more_info() { * * @ingroup themeable */ -function theme_filter_guidelines($format) { +function theme_filter_guidelines($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $name = isset($format->name) ? '' : ''; - return '
      ' . $name . theme('filter_tips', _filter_tips($format->format, FALSE)) . '
      '; + return '
      ' . $name . theme('filter_tips', array('tips' => _filter_tips($format->format, FALSE))) . '
      '; } /** Index: modules/filter/filter.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.pages.inc,v retrieving revision 1.7 diff -u -p -r1.7 filter.pages.inc --- modules/filter/filter.pages.inc 8 Mar 2009 21:25:18 -0000 1.7 +++ modules/filter/filter.pages.inc 28 Sep 2009 22:42:42 -0000 @@ -13,10 +13,10 @@ function filter_tips_long() { $format = arg(2); if ($format) { - $output = theme('filter_tips', _filter_tips($format, TRUE), TRUE); + $output = theme('filter_tips', array('tips' => _filter_tips($format, TRUE), 'long' => TRUE)); } else { - $output = theme('filter_tips', _filter_tips(-1, TRUE), TRUE); + $output = theme('filter_tips', array('tips' => _filter_tips(-1, TRUE), 'long' => TRUE)); } return $output; } @@ -48,7 +48,10 @@ function filter_tips_long() { * @see _filter_tips() * @ingroup themeable */ -function theme_filter_tips($tips, $long = FALSE) { +function theme_filter_tips($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $output = ''; $multiple = count($tips) > 1; Index: modules/forum/forum-icon.tpl.php =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum-icon.tpl.php,v retrieving revision 1.5 diff -u -p -r1.5 forum-icon.tpl.php --- modules/forum/forum-icon.tpl.php 8 Mar 2009 20:58:19 -0000 1.5 +++ modules/forum/forum-icon.tpl.php 28 Sep 2009 22:42:42 -0000 @@ -18,7 +18,7 @@ - + "misc/forum-$icon.png")) ?> Index: modules/forum/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v retrieving revision 1.519 diff -u -p -r1.519 forum.module --- modules/forum/forum.module 18 Sep 2009 00:04:22 -0000 1.519 +++ modules/forum/forum.module 28 Sep 2009 22:42:42 -0000 @@ -568,7 +568,7 @@ function forum_block_view_pre_render($el $result = $elements['#query']->execute(); if ($node_title_list = node_title_list($result)) { $elements['forum_list'] = array('#markup' => $node_title_list); - $elements['forum_more'] = array('#markup' => theme('more_link', url('forum'), t('Read the latest forum topics.'))); + $elements['forum_more'] = array('#markup' => theme('more_link', array('url' => url('forum'), 'title' => t('Read the latest forum topics.')))); } return $elements; } @@ -843,14 +843,14 @@ function template_preprocess_forums(&$va $variables['links'] = $forum_types; if (!empty($variables['forums'])) { - $variables['forums'] = theme('forum_list', $variables['forums'], $variables['parents'], $variables['tid']); + $variables['forums'] = theme('forum_list', $variables); } else { $variables['forums'] = ''; } if ($variables['tid'] && !in_array($variables['tid'], variable_get('forum_containers', array()))) { - $variables['topics'] = theme('forum_topic_list', $variables['tid'], $variables['topics'], $variables['sortby'], $variables['forum_per_page']); + $variables['topics'] = theme('forum_topic_list', $variables); drupal_add_feed(url('taxonomy/term/' . $variables['tid'] . '/0/feed'), 'RSS - ' . $title); } else { @@ -917,7 +917,7 @@ function template_preprocess_forum_list( } $variables['forums'][$id]->old_topics = $forum->num_topics - $variables['forums'][$id]->new_topics; } - $variables['forums'][$id]->last_reply = theme('forum_submitted', $forum->last_post); + $variables['forums'][$id]->last_reply = theme('forum_submitted', array('topic' => $forum->last_post)); } // Give meaning to $tid for themers. $tid actually stands for term id. $variables['forum_id'] = $variables['tid']; @@ -951,7 +951,7 @@ function template_preprocess_forum_topic if (!empty($variables['topics'])) { $row = 0; foreach ($variables['topics'] as $id => $topic) { - $variables['topics'][$id]->icon = theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky); + $variables['topics'][$id]->icon = theme('forum_icon', array('new_posts' => $topic->new, 'num_posts' => $topic->num_comments, 'comment_mode' => $topic->comment_mode, 'sticky' => $topic->sticky)); $variables['topics'][$id]->zebra = $row % 2 == 0 ? 'odd' : 'even'; $row++; @@ -968,8 +968,8 @@ function template_preprocess_forum_topic $variables['topics'][$id]->title = l($topic->title, "node/$topic->nid"); $variables['topics'][$id]->message = ''; } - $variables['topics'][$id]->created = theme('forum_submitted', $topic); - $variables['topics'][$id]->last_reply = theme('forum_submitted', isset($topic->last_reply) ? $topic->last_reply : NULL); + $variables['topics'][$id]->created = theme('forum_submitted', array('topic' => $topic)); + $variables['topics'][$id]->last_reply = theme('forum_submitted', array('topic' => isset($topic->last_reply) ? $topic->last_reply : NULL)); $variables['topics'][$id]->new_text = ''; $variables['topics'][$id]->new_url = ''; @@ -988,7 +988,7 @@ function template_preprocess_forum_topic $variables['topic_id'] = $variables['tid']; unset($variables['tid']); - $variables['pager'] = theme('pager', NULL); + $variables['pager'] = theme('pager', array('tags' => NULL)); } /** @@ -1030,7 +1030,7 @@ function template_preprocess_forum_icon( * @see theme_forum_submitted() */ function template_preprocess_forum_submitted(&$variables) { - $variables['author'] = isset($variables['topic']->uid) ? theme('username', $variables['topic']) : ''; + $variables['author'] = isset($variables['topic']->uid) ? theme('username', array('account' => $variables['topic'])) : ''; $variables['time'] = isset($variables['topic']->timestamp) ? format_interval(REQUEST_TIME - $variables['topic']->timestamp) : ''; } Index: modules/forum/forum.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.pages.inc,v retrieving revision 1.2 diff -u -p -r1.2 forum.pages.inc --- modules/forum/forum.pages.inc 26 Jul 2007 06:48:03 -0000 1.2 +++ modules/forum/forum.pages.inc 28 Sep 2009 22:42:42 -0000 @@ -20,5 +20,5 @@ function forum_page($tid = 0) { $topics = forum_get_topics($tid, $sortby, $forum_per_page); } - return theme('forums', $forums, $topics, $parents, $tid, $sortby, $forum_per_page); + return theme('forums', array('forums' => $forums, 'topics' => $topics, 'parents' => $parents, 'tid' => $tid, 'sortby' => $sortby, 'forums_per_page' => $forum_per_page)); } Index: modules/forum/forums.tpl.php =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forums.tpl.php,v retrieving revision 1.5 diff -u -p -r1.5 forums.tpl.php --- modules/forum/forums.tpl.php 13 Oct 2008 12:31:42 -0000 1.5 +++ modules/forum/forums.tpl.php 28 Sep 2009 22:42:42 -0000 @@ -20,7 +20,7 @@ ?>
      - + $links)); ?>
      Index: modules/help/help.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/help/help.admin.inc,v retrieving revision 1.9 diff -u -p -r1.9 help.admin.inc --- modules/help/help.admin.inc 6 Jun 2009 16:05:26 -0000 1.9 +++ modules/help/help.admin.inc 28 Sep 2009 22:42:42 -0000 @@ -38,7 +38,7 @@ function help_page($name) { $admin_tasks = system_get_module_admin_tasks($name); if (!empty($admin_tasks)) { ksort($admin_tasks); - $output .= theme('item_list', $admin_tasks, t('@module administration pages', array('@module' => $module['name']))); + $output .= theme('item_list', array('items' => $admin_tasks, 'title' => t('@module administration pages', array('@module' => $module['name'])))); } } Index: modules/image/image.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/image/image.admin.inc,v retrieving revision 1.11 diff -u -p -r1.11 image.admin.inc --- modules/image/image.admin.inc 18 Sep 2009 00:12:46 -0000 1.11 +++ modules/image/image.admin.inc 28 Sep 2009 22:42:42 -0000 @@ -14,7 +14,7 @@ function image_style_list() { $styles = image_styles(); $page['image_style_list'] = array( - '#markup' => theme('image_style_list', $styles), + '#markup' => theme('image_style_list', array('styles' => $styles)), '#attached' => array( 'css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array('preprocess' => FALSE)), ), @@ -64,7 +64,7 @@ function image_style_form($form, &$form_ '#markup' => $effect['label'], ); $form['effects'][$ieid]['summary'] = array( - '#markup' => isset($effect['summary theme']) ? theme($effect['summary theme'], $effect['data']) : '', + '#markup' => isset($effect['summary theme']) ? theme($effect['summary theme'], array('data' => $effect['data'])) : '', ); $form['effects'][$ieid]['weight'] = array( '#type' => 'weight', @@ -106,7 +106,7 @@ function image_style_form($form, &$form_ $form['preview'] = array( '#type' => 'item', '#title' => t('Preview'), - '#markup' => theme('image_style_preview', $style), + '#markup' => theme('image_style_preview', array('style' => $style)), ); $form['submit'] = array( '#type' => 'submit', @@ -560,7 +560,10 @@ function image_rotate_form($data) { * @see image_get_styles() * @ingroup themeable */ -function theme_image_style_list($styles) { +function theme_image_style_list($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $header = array(t('Style name'), array('data' => t('Operations'), 'colspan' => 3)); $rows = array(); foreach ($styles as $style) { @@ -583,7 +586,7 @@ function theme_image_style_list($styles) )); } - return theme('table', $header, $rows); + return theme('table', array('header' => $header, 'rows' => $rows)); } /** @@ -593,7 +596,10 @@ function theme_image_style_list($styles) * An associative array containing the structure of the effects group. * @ingroup themeable */ -function theme_image_style_effects($form) { +function theme_image_style_effects($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $rows = array(); foreach (element_children($form) as $key) { @@ -634,7 +640,7 @@ function theme_image_style_effects($form ))); } - $output = theme('table', $header, $rows, array('id' => 'image-style-effects')); + $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'image-style-effects'))); drupal_add_tabledrag('image-style-effects', 'order', 'sibling', 'image-effect-order-weight'); return $output; } @@ -646,7 +652,10 @@ function theme_image_style_effects($form * The image style array being previewed. * @ingroup themeable */ -function theme_image_style_preview($style) { +function theme_image_style_preview($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $sample_image = variable_get('image_style_preview_image', drupal_get_path('module', 'image') . '/sample.png'); $sample_width = 160; $sample_height = 160; @@ -690,7 +699,7 @@ function theme_image_style_preview($styl $output .= '
      '; $output .= t('original') . ' (' . l(t('view actual size'), $original_path) . ')'; $output .= ''; // End preview-image. @@ -700,7 +709,7 @@ function theme_image_style_preview($styl $output .= '
      '; $output .= check_plain($style['name']) . ' (' . l(t('view actual size'), file_create_url($preview_file) . '?' . time()) . ')'; $output .= ''; // End preview-image. @@ -718,7 +727,10 @@ function theme_image_style_preview($styl * A Form API element containing radio buttons. * @ingroup themeable */ -function theme_image_anchor($element) { +function theme_image_anchor($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $rows = array(); $row = array(); foreach (element_children($element) as $n => $key) { @@ -731,7 +743,7 @@ function theme_image_anchor($element) { } } - return theme('table', array(), $rows, array('class' => array('image-anchor'))); + return theme('table', array('header' => array(), 'rows' => $rows, 'attributes' => array('class' => array('image-anchor')))); } /** @@ -741,7 +753,10 @@ function theme_image_anchor($element) { * The current configuration for this resize effect. * @ingroup themeable */ -function theme_image_resize_summary($data) { +function theme_image_resize_summary($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + if ($data['width'] && $data['height']) { return check_plain($data['width']) . 'x' . check_plain($data['height']); } @@ -757,8 +772,11 @@ function theme_image_resize_summary($dat * The current configuration for this scale effect. * @ingroup themeable */ -function theme_image_scale_summary($data) { - return theme('image_resize_summary', $data) . ' ' . ($data['upscale'] ? '(' . t('upscaling allowed') . ')' : ''); +function theme_image_scale_summary($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + + return theme('image_resize_summary', array('data' => $data)) . ' ' . ($data['upscale'] ? '(' . t('upscaling allowed') . ')' : ''); } /** @@ -768,8 +786,8 @@ function theme_image_scale_summary($data * The current configuration for this crop effect. * @ingroup themeable */ -function theme_image_crop_summary($data) { - return theme('image_resize_summary', $data); +function theme_image_crop_summary($variables) { + return theme('image_resize_summary', $variables); } /** @@ -779,6 +797,9 @@ function theme_image_crop_summary($data) * The current configuration for this rotate effect. * @ingroup themeable */ -function theme_image_rotate_summary($data) { +function theme_image_rotate_summary($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + return ($data['random']) ? t('random between -@degrees° and @degrees°', array('@degrees' => str_replace('-', '', $data['degrees']))) : t('@degrees°', array('@degrees' => $data['degrees'])); } Index: modules/image/image.module =================================================================== RCS file: /cvs/drupal/drupal/modules/image/image.module,v retrieving revision 1.16 diff -u -p -r1.16 image.module --- modules/image/image.module 26 Aug 2009 03:20:39 -0000 1.16 +++ modules/image/image.module 28 Sep 2009 22:42:43 -0000 @@ -20,7 +20,7 @@ function image_help($path, $arg) { $output .= '

      ' . t('Image styles') . '

      '; $output .= '

      ' . t('Image styles allow your site to output an image in several different ways without affecting the original image. Any created images will automatically be refreshed if any changes are made to the image style.') .'

      '; $output .= '

      ' . t('Every image style must have a name, which will be used in the URL of generated images. There are two common approaches to naming image styles:') . '

      '; - $output .= theme('item_list', $naming_approaches); + $output .= theme('item_list', array('items' => $naming_approaches)); $output .= '

      ' . t('Both approaches are common and which you choose depends on how you use the image style.') . '

      '; $output .= '

      ' . t('After creating an image style, effects may be added to the style. Image module comes with some basic effects such as crop, scale, desaturate, and rotate. In addition to the effects included with Image, other modules may provide additional effects. Multiple effects may be combined together, such as using the crop and scale effect and the desaturate effect, you could create square, grayscale thumbnails.'); return $output; @@ -128,7 +128,7 @@ function image_theme() { return array( 'image_style' => array( 'arguments' => array( - 'style' => NULL, + 'style_name' => NULL, 'path' => NULL, 'alt' => '', 'title' => '', @@ -802,7 +802,10 @@ function image_effect_apply($image, $eff * A string containing the image tag. * @ingroup themeable */ -function theme_image_style($style_name, $path, $alt = '', $title = '', $attributes = array(), $getsize = TRUE) { +function theme_image_style($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + // theme_image() can only honor the $getsize parameter with local file paths. // The derivative image is not created until it has been requested so the file // may not yet exist, in this case we just fallback to the URL. @@ -810,7 +813,8 @@ function theme_image_style($style_name, if (!file_exists($style_path)) { $style_path = image_style_url($style_name, $path); } - return theme('image', file_create_url($style_path), $alt, $title, $attributes, $getsize); + $variables['path'] = file_create_url($style_path); + return theme('image', $variables); } /** Index: modules/locale/locale.module =================================================================== RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v retrieving revision 1.259 diff -u -p -r1.259 locale.module --- modules/locale/locale.module 22 Sep 2009 07:50:16 -0000 1.259 +++ modules/locale/locale.module 28 Sep 2009 22:42:43 -0000 @@ -656,7 +656,7 @@ function locale_block_view($delta = '') drupal_alter('translation_link', $links, $path); $block['subject'] = t('Languages'); - $block['content'] = theme('links', $links, array()); + $block['content'] = theme('links', array('links' => $links, 'attributes' => array())); return $block; } } @@ -666,7 +666,10 @@ function locale_block_view($delta = '') * * @ingroup themeable */ -function theme_locale_translation_filters($form) { +function theme_locale_translation_filters($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $output = ''; foreach (element_children($form['status']) as $key) { $output .= drupal_render($form['status'][$key]); Index: modules/menu/menu.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.admin.inc,v retrieving revision 1.60 diff -u -p -r1.60 menu.admin.inc --- modules/menu/menu.admin.inc 28 Sep 2009 22:14:30 -0000 1.60 +++ modules/menu/menu.admin.inc 28 Sep 2009 22:42:43 -0000 @@ -14,22 +14,22 @@ function menu_overview_page() { $header = array(t('Title'), array('data' => t('Operations'), 'colspan' => '3')); $rows = array(); foreach ($result as $menu) { - $row = array(theme('menu_admin_overview', $menu['title'], $menu['menu_name'], $menu['description'])); + $row = array(theme('menu_admin_overview', array('title' => $menu['title'], 'name' => $menu['menu_name'], 'description' => $menu['description']))); $row[] = array('data' => l(t('list links'), 'admin/structure/menu/manage/' . $menu['menu_name'])); $row[] = array('data' => l(t('edit menu'), 'admin/structure/menu/manage/' . $menu['menu_name'] . '/edit')); $row[] = array('data' => l(t('add link'), 'admin/structure/menu/manage/' . $menu['menu_name'] . '/add')); $rows[] = $row; } - return theme('table', $header, $rows); + return theme('table', array('header' => $header, 'rows' => $rows)); } /** * Theme the menu title and description for admin page */ -function theme_menu_admin_overview($title, $name, $description) { - $output = check_plain($title); - $output .= '

      ' . filter_xss_admin($description) . '
      '; +function theme_menu_admin_overview($variables) { + $output = check_plain($variables['title']); + $output .= '
      ' . filter_xss_admin($variables['description']) . '
      '; return $output; } @@ -186,7 +186,10 @@ function menu_overview_form_submit($form * * @ingroup themeable */ -function theme_menu_overview_form($form) { +function theme_menu_overview_form($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + drupal_add_tabledrag('menu-overview', 'match', 'parent', 'menu-plid', 'menu-plid', 'menu-mlid', TRUE, MENU_MAX_DEPTH - 1); drupal_add_tabledrag('menu-overview', 'order', 'sibling', 'menu-weight'); @@ -220,7 +223,7 @@ function theme_menu_overview_form($form) $element['plid']['#type'] = 'hidden'; $row = array(); - $row[] = theme('indentation', $element['#item']['depth'] - 1) . drupal_render($element['title']); + $row[] = theme('indentation', array('size' => $element['#item']['depth'] - 1)) . drupal_render($element['title']); $row[] = array('data' => drupal_render($element['hidden']), 'class' => array('checkbox')); $row[] = array('data' => drupal_render($element['expanded']), 'class' => array('checkbox')); $row[] = drupal_render($element['weight']) . drupal_render($element['plid']) . drupal_render($element['mlid']); @@ -235,7 +238,7 @@ function theme_menu_overview_form($form) if (empty($rows)) { $rows[] = array(array('data' => $form['#empty_text'], 'colspan' => '7')); } - $output .= theme('table', $header, $rows, array('id' => 'menu-overview')); + $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'menu-overview'))); $output .= drupal_render_children($form); return $output; } Index: modules/node/content_types.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/content_types.inc,v retrieving revision 1.95 diff -u -p -r1.95 content_types.inc --- modules/node/content_types.inc 28 Sep 2009 22:14:30 -0000 1.95 +++ modules/node/content_types.inc 28 Sep 2009 22:42:43 -0000 @@ -16,10 +16,10 @@ function node_overview_types() { $rows = array(); foreach ($names as $key => $name) { - $type = $types[$key]; + $type = $types[$key]; if (node_hook($type->type, 'form')) { $type_url_str = str_replace('_', '-', $type->type); - $row = array(theme('node_admin_overview', $name, $type)); + $row = array(theme('node_admin_overview', array('name' => $name, 'type' => $type))); // Set the edit column. $row[] = array('data' => l(t('edit'), 'admin/structure/types/manage/' . $type_url_str)); @@ -37,7 +37,7 @@ function node_overview_types() { if (empty($rows)) { $rows[] = array(array('data' => t('No content types available. Add content type.', array('@link' => url('admin/structure/types/add'))), 'colspan' => '5', 'class' => array('message'))); } - + $build['node_table'] = array( '#theme' => 'table', '#header' => $header, @@ -47,7 +47,10 @@ function node_overview_types() { return $build; } -function theme_node_admin_overview($name, $type) { +function theme_node_admin_overview($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $output = check_plain($name); $output .= ' (Machine name: ' . check_plain($type->type) . ')'; $output .= '
      ' . filter_xss_admin($type->description) . '
      '; @@ -196,7 +199,7 @@ function node_type_form($form, &$form_st '#description' => t('Enable the submitted by Username on date text.'), ); $form['display']['teaser_length'] = array( - '#type' => 'select', + '#type' => 'select', '#title' => t('Length of trimmed posts'), '#default_value' => variable_get('teaser_length_' . $type->type, 600), '#options' => drupal_map_assoc(array(0, 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000), '_node_characters'), Index: modules/node/node.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v retrieving revision 1.67 diff -u -p -r1.67 node.admin.inc --- modules/node/node.admin.inc 18 Sep 2009 00:12:47 -0000 1.67 +++ modules/node/node.admin.inc 28 Sep 2009 22:42:43 -0000 @@ -192,7 +192,10 @@ function node_filter_form() { * * @ingroup themeable */ -function theme_node_filter_form($form) { +function theme_node_filter_form($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $output = ''; $output .= '
      '; $output .= drupal_render($form['filters']); @@ -206,7 +209,10 @@ function theme_node_filter_form($form) { * * @ingroup themeable */ -function theme_node_filters($form) { +function theme_node_filters($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $output = ''; $output .= '
        '; if (!empty($form['current'])) { @@ -358,7 +364,7 @@ function _node_mass_update_batch_finishe else { drupal_set_message(t('An error occurred and processing did not complete.'), 'error'); $message = format_plural(count($results), '1 item successfully processed:', '@count items successfully processed:'); - $message .= theme('item_list', $results); + $message .= theme('item_list', array('items' => $results)); drupal_set_message($message); } } @@ -373,7 +379,7 @@ function node_admin_content($form, $form // Show the 'add new content' link. $form['add_content'] = array( '#access' => _node_add_access(), - '#markup' => theme('links', array(array('title' => t('Add new content'), 'href' => 'node/add')), array('class' => array('action-links'))), + '#markup' => theme('links', array('links' => array(array('title' => t('Add new content'), 'href' => 'node/add')), 'attributes' => array('class' => array('action-links')))), ); $form[] = node_filter_form(); $form['#submit'][] = 'node_filter_form_submit'; @@ -447,9 +453,9 @@ function node_admin_nodes() { foreach ($result as $node) { $nodes[$node->nid] = ''; $options = empty($node->language) ? array() : array('language' => $languages[$node->language]); - $form['title'][$node->nid] = array('#markup' => l($node->title, 'node/' . $node->nid, $options) . ' ' . theme('mark', node_mark($node->nid, $node->changed))); + $form['title'][$node->nid] = array('#markup' => l($node->title, 'node/' . $node->nid, $options) . ' ' . theme('mark', array('type' => node_mark($node->nid, $node->changed)))); $form['name'][$node->nid] = array('#markup' => check_plain(node_type_get_name($node))); - $form['username'][$node->nid] = array('#markup' => theme('username', $node)); + $form['username'][$node->nid] = array('#markup' => theme('username', array('account' => $node))); $form['status'][$node->nid] = array('#markup' => ($node->status ? t('published') : t('not published'))); $form['changed'][$node->nid] = array('#markup' => format_date($node->changed, 'short')); if ($multilanguage) { @@ -461,7 +467,7 @@ function node_admin_nodes() { '#type' => 'checkboxes', '#options' => $nodes, ); - $form['pager'] = array('#markup' => theme('pager', NULL)); + $form['pager'] = array('#markup' => theme('pager', array('tags' => NULL))); $form['#theme'] = 'node_admin_nodes'; return $form; } @@ -514,7 +520,10 @@ function node_admin_nodes_submit($form, * * @ingroup themeable */ -function theme_node_admin_nodes($form) { +function theme_node_admin_nodes($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $output = ''; $output .= drupal_render($form['options']); @@ -544,7 +553,7 @@ function theme_node_admin_nodes($form) { ); } - $output .= theme('table', $header, $rows); + $output .= theme('table', array('header' => $header, 'rows' => $rows)); if ($form['pager']['#markup']) { $output .= drupal_render($form['pager']); Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.1133 diff -u -p -r1.1133 node.module --- modules/node/node.module 28 Sep 2009 22:14:30 -0000 1.1133 +++ modules/node/node.module 28 Sep 2009 22:42:43 -0000 @@ -274,7 +274,7 @@ function node_title_list($result, $title $num_rows = TRUE; } - return $num_rows ? theme('node_list', $items, $title) : FALSE; + return $num_rows ? theme('node_list', array('items' => $items, 'title' => $title)) : FALSE; } /** @@ -282,8 +282,8 @@ function node_title_list($result, $title * * @ingroup themeable */ -function theme_node_list($items, $title = NULL) { - return theme('item_list', $items, $title); +function theme_node_list($variables) { + return theme('item_list', $variables); } /** @@ -1056,7 +1056,7 @@ function node_build($node, $build_mode = $build = $node->content; // We don't need duplicate rendering info in node->content. unset($node->content); - + $build += array( '#theme' => 'node', '#node' => $node, @@ -1182,7 +1182,7 @@ function template_preprocess_node(&$vari // Flatten the node object's member fields. $variables = array_merge((array)$node, $variables); - + // Helpful $content variable for templates. foreach (element_children($variables['elements']) as $key) { $variables['content'][$key] = $variables['elements'][$key]; @@ -1194,7 +1194,7 @@ function template_preprocess_node(&$vari // Display post information only on certain node types. if (variable_get('node_submitted_' . $node->type, TRUE)) { $variables['display_submitted'] = TRUE; - $variables['user_picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', $node) : ''; + $variables['user_picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', array('account' => $node)) : ''; } else { $variables['display_submitted'] = FALSE; @@ -1229,7 +1229,10 @@ function template_preprocess_node(&$vari * * @ingroup themeable */ -function theme_node_log_message($log) { +function theme_node_log_message($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + return '
        ' . t('Log') . ':
        ' . $log . '
        '; } @@ -1352,7 +1355,7 @@ function node_search_admin() { $form['content_ranking']['info'] = array( '#value' => '' . t('The following numbers control which properties the content search should favor when ordering the results. Higher numbers mean more influence, zero means the property is ignored. Changing these numbers does not require the search index to be rebuilt. Changes take effect immediately.') . '' ); - + // Note: reversed to reflect that higher number = higher ranking. $options = drupal_map_assoc(range(0, 10)); foreach (module_invoke_all('ranking') as $var => $values) { @@ -1377,7 +1380,7 @@ function node_search_execute($keys = NUL ->condition('n.status', 1) ->addTag('node_access') ->searchExpression($keys, 'node'); - + // Insert special keywords. $query->setOption('type', 'n.type'); $query->setOption('language', 'n.language'); @@ -1388,10 +1391,10 @@ function node_search_execute($keys = NUL if (!$query->executeFirstPass()) { return array(); } - + // Add the ranking expressions. _node_rankings($query); - + // Add a count query. $inner_query = clone $query; $count_query = db_select($inner_query->fields('i', array('sid'))); @@ -1400,7 +1403,7 @@ function node_search_execute($keys = NUL $find = $query ->limit(10) ->execute(); - + // Load results. $results = array(); foreach ($find as $item) { @@ -1408,19 +1411,19 @@ function node_search_execute($keys = NUL $node = node_load($item->sid); node_build_content($node, 'search_result'); $node->rendered = drupal_render($node->content); - + // Fetch comments for snippet. $node->rendered .= ' ' . module_invoke('comment', 'node_update_index', $node); // Fetch terms for snippet. $node->rendered .= ' ' . module_invoke('taxonomy', 'node_update_index', $node); - + $extra = module_invoke_all('node_search_result', $node); - + $results[] = array( 'link' => url('node/' . $item->sid, array('absolute' => TRUE)), 'type' => check_plain(node_type_get_name($node)), 'title' => $node->title, - 'user' => theme('username', $node), + 'user' => theme('username', array('account' => $node)), 'date' => $node->changed, 'node' => $node, 'extra' => $extra, @@ -1529,7 +1532,10 @@ function node_user_cancel($edit, $accoun * * @ingroup themeable */ -function theme_node_search_admin($form) { +function theme_node_search_admin($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $output = drupal_render($form['info']); $header = array(t('Factor'), t('Weight')); @@ -1540,7 +1546,7 @@ function theme_node_search_admin($form) $row[] = drupal_render($form['factors'][$key]); $rows[] = $row; } - $output .= theme('table', $header, $rows); + $output .= theme('table', array('header' => $header, 'rows' => $rows)); $output .= drupal_render_children($form); return $output; @@ -1815,7 +1821,7 @@ function node_block_info() { */ function node_block_view($delta = '') { $block['subject'] = t('Syndicate'); - $block['content'] = theme('feed_icon', url('rss.xml'), t('Syndicate')); + $block['content'] = theme('feed_icon', array('url' => url('rss.xml'), 'title' => t('Syndicate'))); return $block; } @@ -1963,7 +1969,7 @@ function node_page_default() { $default_links[] = l(t('Change the default front page'), 'admin/config/system/site-information'); } if (!empty($default_links)) { - $default_message .= theme('item_list', $default_links); + $default_message .= theme('item_list', array('items' => $default_links)); } $build['default_message'] = array( Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.82 diff -u -p -r1.82 node.pages.inc --- modules/node/node.pages.inc 25 Sep 2009 14:24:34 -0000 1.82 +++ modules/node/node.pages.inc 28 Sep 2009 22:42:43 -0000 @@ -24,7 +24,7 @@ function node_add_page() { $item = array_shift($content); drupal_goto($item['href']); } - return theme('node_add_list', $content); + return theme('node_add_list', array('content' => $content)); } /** @@ -32,7 +32,10 @@ function node_add_page() { * * @ingroup themeable */ -function theme_node_add_list($content) { +function theme_node_add_list($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $output = ''; if ($content) { @@ -320,7 +323,10 @@ function node_form_build_preview($form, * * @ingroup themeable */ -function theme_node_form($form) { +function theme_node_form($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $output = "\n
        \n"; $output .= "
        \n"; @@ -363,7 +369,7 @@ function node_preview($node) { if (!form_get_errors()) { $cloned_node = clone $node; $cloned_node->in_preview = TRUE; - $output = theme('node_preview', $cloned_node); + $output = theme('node_preview', array('node' => $cloned_node)); } drupal_set_title(t('Preview'), PASS_THROUGH); @@ -379,7 +385,10 @@ function node_preview($node) { * * @ingroup themeable */ -function theme_node_preview($node) { +function theme_node_preview($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $output = '
        '; $preview_trimmed_version = FALSE; @@ -506,13 +515,13 @@ function node_revision_overview($node) { $operations = array(); if ($revision->current_vid > 0) { - $row[] = array('data' => t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'short'), "node/$node->nid"), '!username' => theme('username', $revision))) + $row[] = array('data' => t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'short'), "node/$node->nid"), '!username' => theme('username', array('account' => $revision)))) . (($revision->log != '') ? '

        ' . filter_xss($revision->log) . '

        ' : ''), 'class' => array('revision-current')); - $operations[] = array('data' => theme('placeholder', t('current revision')), 'class' => array('revision-current'), 'colspan' => 2); + $operations[] = array('data' => theme('placeholder', array('text' => t('current revision'))), 'class' => array('revision-current'), 'colspan' => 2); } else { - $row[] = t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'short'), "node/$node->nid/revisions/$revision->vid/view"), '!username' => theme('username', $revision))) + $row[] = t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'short'), "node/$node->nid/revisions/$revision->vid/view"), '!username' => theme('username', array('account' => $revision)))) . (($revision->log != '') ? '

        ' . filter_xss($revision->log) . '

        ' : ''); if ($revert_permission) { $operations[] = l(t('revert'), "node/$node->nid/revisions/$revision->vid/revert"); @@ -523,7 +532,7 @@ function node_revision_overview($node) { } $rows[] = array_merge($row, $operations); } - + $build['node_revisions_table'] = array( '#theme' => 'table', '#rows' => $rows, Index: modules/openid/openid.module =================================================================== RCS file: /cvs/drupal/drupal/modules/openid/openid.module,v retrieving revision 1.61 diff -u -p -r1.61 openid.module --- modules/openid/openid.module 22 Sep 2009 07:50:16 -0000 1.61 +++ modules/openid/openid.module 28 Sep 2009 22:42:43 -0000 @@ -107,7 +107,7 @@ function _openid_user_login_form_alter(& ); $form['openid_links'] = array( - '#markup' => theme('item_list', $items), + '#markup' => theme('item_list', array('items' => $items)), '#weight' => 1, ); Index: modules/poll/poll.module =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v retrieving revision 1.314 diff -u -p -r1.314 poll.module --- modules/poll/poll.module 21 Sep 2009 08:54:57 -0000 1.314 +++ modules/poll/poll.module 28 Sep 2009 22:42:43 -0000 @@ -734,11 +734,11 @@ function poll_view_results($node, $build foreach ($node->choice as $i => $choice) { if (!empty($choice['chtext'])) { $chvotes = isset($choice['chvotes']) ? $choice['chvotes'] : NULL; - $poll_results .= theme('poll_bar', $choice['chtext'], $chvotes, $total_votes, isset($node->vote) && $node->vote == $i, $block); + $poll_results .= theme('poll_bar', array('title' => $choice['chtext'], 'votes' => $chvotes, 'total_votes' => $total_votes, 'vote' => isset($node->vote) && $node->vote == $i, 'block' => $block)); } } - return theme('poll_results', $node->title, $poll_results, $total_votes, isset($node->links) ? $node->links : array(), $block, $node->nid, isset($node->vote) ? $node->vote : NULL); + return theme('poll_results', array('raw_title' => $node->title, 'results' => $poll_results, 'votes' => $total_votes, 'raw_links' => isset($node->links) ? $node->links : array(), 'block' => $block, 'nid' => $node->nid, 'vote' => isset($node->vote) ? $node->vote : NULL)); } @@ -747,7 +747,10 @@ function poll_view_results($node, $build * * @ingroup themeable */ -function theme_poll_choices($form) { +function theme_poll_choices($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + drupal_add_tabledrag('poll-choice-table', 'order', 'sibling', 'poll-weight'); $delta = 0; @@ -783,7 +786,7 @@ function theme_poll_choices($form) { $rows[] = $row; } - $output = theme('table', $headers, $rows, array('id' => 'poll-choice-table')); + $output = theme('table', array('header' => $headers, 'rows' => $rows, 'attributes' => array('id' => 'poll-choice-table'))); $output .= drupal_render_children($form); return $output; } @@ -802,7 +805,7 @@ function theme_poll_choices($form) { * @see theme_poll_results() */ function template_preprocess_poll_results(&$variables) { - $variables['links'] = theme('links', $variables['raw_links']); + $variables['links'] = theme('links', array('links' => $variables['raw_links'])); if (isset($variables['vote']) && $variables['vote'] > -1 && user_access('cancel own vote')) { $variables['cancel_form'] = drupal_render(drupal_get_form('poll_cancel_form', $variables['nid'])); } Index: modules/poll/poll.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.pages.inc,v retrieving revision 1.20 diff -u -p -r1.20 poll.pages.inc --- modules/poll/poll.pages.inc 29 Jul 2009 06:39:34 -0000 1.20 +++ modules/poll/poll.pages.inc 28 Sep 2009 22:42:43 -0000 @@ -42,7 +42,7 @@ function poll_page() { $output .= '
      • ' . l($node->title, "node/$node->nid") . ' - ' . format_plural($node->votes, '1 vote', '@count votes') . ' - ' . ($node->active ? t('open') : t('closed')) . '
      • '; } $output .= '
      '; - $output .= theme("pager", NULL); + $output .= theme("pager", array('tags' => NULL)); return $output; } @@ -72,14 +72,14 @@ function poll_votes($node) { $rows = array(); foreach ($queried_votes as $vote) { $rows[] = array( - $vote->name ? theme('username', $vote) : check_plain($vote->hostname), + $vote->name ? theme('username', array('account' => $vote)) : check_plain($vote->hostname), check_plain($vote->chtext), format_date($vote->timestamp), ); } $build['poll_votes_table'] = array( - '#theme' => 'table', - '#header' => $header, + '#theme' => 'table', + '#header' => $header, '#rows' => $rows, '#prefix' => t('This table lists all the recorded votes for this poll. If anonymous users are allowed to vote, they will be identified by the IP address of the computer they used when they voted.'), ); Index: modules/profile/profile.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.admin.inc,v retrieving revision 1.32 diff -u -p -r1.32 profile.admin.inc --- modules/profile/profile.admin.inc 21 Sep 2009 07:56:08 -0000 1.32 +++ modules/profile/profile.admin.inc 28 Sep 2009 22:42:43 -0000 @@ -95,7 +95,10 @@ function profile_admin_overview_submit($ * @ingroup themeable * @see profile_admin_overview() */ -function theme_profile_admin_overview($form) { +function theme_profile_admin_overview($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + drupal_add_css(drupal_get_path('module', 'profile') . '/profile.css'); // Add javascript if there's more than one field. if (isset($form['submit'])) { @@ -156,7 +159,7 @@ function theme_profile_admin_overview($f } $header[] = array('data' => t('Operations'), 'colspan' => 2); - $output = theme('table', $header, $rows, array('id' => 'profile-fields')); + $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'profile-fields'))); $output .= drupal_render_children($form); return $output; Index: modules/profile/profile.module =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v retrieving revision 1.276 diff -u -p -r1.276 profile.module --- modules/profile/profile.module 22 Sep 2009 07:50:16 -0000 1.276 +++ modules/profile/profile.module 28 Sep 2009 22:42:43 -0000 @@ -193,7 +193,7 @@ function profile_block_view($delta = '') if (!empty($fields)) { $profile = _profile_update_user_fields($fields, $account); - $output .= theme('profile_block', $account, $profile, TRUE); + $output .= theme('profile_block', array('account' => $account, 'fields' => $profile)); } if (isset($use_fields['user_profile']) && $use_fields['user_profile']) { @@ -525,7 +525,7 @@ function profile_category_access($accoun */ function template_preprocess_profile_block(&$variables) { - $variables['user_picture'] = theme('user_picture', $variables['account']); + $variables['user_picture'] = theme('user_picture', array('account' => $variables['account'])); $variables['profile'] = array(); // Supply filtered version of $fields that have values. foreach ($variables['fields'] as $field) { @@ -549,8 +549,8 @@ function template_preprocess_profile_blo */ function template_preprocess_profile_listing(&$variables) { - $variables['user_picture'] = theme('user_picture', $variables['account']); - $variables['name'] = theme('username', $variables['account']); + $variables['user_picture'] = theme('user_picture', array('account' => $variables['account'])); + $variables['name'] = theme('username', array('account' => $variables['account'])); $variables['profile'] = array(); // Supply filtered version of $fields that have values. foreach ($variables['fields'] as $field) { Index: modules/profile/profile.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.pages.inc,v retrieving revision 1.20 diff -u -p -r1.20 profile.pages.inc --- modules/profile/profile.pages.inc 21 Sep 2009 07:56:08 -0000 1.20 +++ modules/profile/profile.pages.inc 28 Sep 2009 22:42:43 -0000 @@ -71,13 +71,13 @@ function profile_browse() { $content = ''; foreach ($users as $account) { $profile = _profile_update_user_fields($fields, $account); - $content .= theme('profile_listing', $account, $profile); + $content .= theme('profile_listing', array('account' => $account, 'fields' => $profile)); } - $output = theme('profile_wrapper', $content); - $output .= theme('pager', NULL); + $output = theme('profile_wrapper', array('content' => $content)); + $output .= theme('pager', array('tags' => NULL)); if ($field->type == 'selection' || $field->type == 'list' || $field->type == 'textfield') { - $title = strtr(check_plain($field->page), array('%value' => theme('placeholder', $value))); + $title = strtr(check_plain($field->page), array('%value' => theme('placeholder', array('text' => $value)))); } else { $title = check_plain($field->page); @@ -108,10 +108,10 @@ function profile_browse() { $content = ''; foreach ($users as $account) { $profile = _profile_update_user_fields($fields, $account); - $content .= theme('profile_listing', $account, $profile); + $content .= theme('profile_listing', array('account' => $account, 'fields' => $profile)); } - $output = theme('profile_wrapper', $content); - $output .= theme('pager', NULL); + $output = theme('profile_wrapper', array('content' => $content)); + $output .= theme('pager', array('tags' => NULL)); drupal_set_title(t('User list')); return $output; Index: modules/search/search.api.php =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.api.php,v retrieving revision 1.16 diff -u -p -r1.16 search.api.php --- modules/search/search.api.php 18 Sep 2009 00:12:47 -0000 1.16 +++ modules/search/search.api.php 28 Sep 2009 22:42:43 -0000 @@ -16,7 +16,7 @@ * * This hook allows a module to perform searches on content it defines * (custom node types, users, or comments, for example) when a site search - * is performed. + * is performed. * * Note that you can use form API to extend the search. You will need to use * hook_form_alter() to add any additional required form elements. You can @@ -192,7 +192,7 @@ function hook_search_execute($keys = NUL 'link' => url('node/' . $item->sid, array('absolute' => TRUE)), 'type' => check_plain(node_type_get_name($node)), 'title' => $node->title, - 'user' => theme('username', $node), + 'user' => theme('username', array('account' => $node)), 'date' => $node->changed, 'node' => $node, 'extra' => $extra, Index: modules/search/search.module =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.module,v retrieving revision 1.318 diff -u -p -r1.318 search.module --- modules/search/search.module 21 Sep 2009 06:44:14 -0000 1.318 +++ modules/search/search.module 28 Sep 2009 22:42:43 -0000 @@ -965,7 +965,7 @@ function search_data($keys = NULL, $type return module_invoke($type, 'search_page', $results); } else { - return theme('search_results', $results, $type); + return theme('search_results', array('results' => $results, 'type' => $type)); } } } Index: modules/search/search.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.pages.inc,v retrieving revision 1.11 diff -u -p -r1.11 search.pages.inc --- modules/search/search.pages.inc 25 Aug 2009 10:27:14 -0000 1.11 +++ modules/search/search.pages.inc 28 Sep 2009 22:42:43 -0000 @@ -56,7 +56,10 @@ function search_view($type = 'node') { * @return * A string containing the listing output. */ -function theme_search_results_listing($title, $content) { +function theme_search_results_listing($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $output = '

      ' . $title . '

      ' . $content . '
      '; return $output; } @@ -73,9 +76,9 @@ function theme_search_results_listing($t function template_preprocess_search_results(&$variables) { $variables['search_results'] = ''; foreach ($variables['results'] as $result) { - $variables['search_results'] .= theme('search_result', $result, $variables['type']); + $variables['search_results'] .= theme('search_result', array('result' => $result, 'type' => $variables['type'])); } - $variables['pager'] = theme('pager', NULL); + $variables['pager'] = theme('pager', array('tags' => NULL)); // Provide alternate search results template. $variables['template_files'][] = 'search-results-' . $variables['type']; } Index: modules/simpletest/simpletest.module =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.module,v retrieving revision 1.74 diff -u -p -r1.74 simpletest.module --- modules/simpletest/simpletest.module 21 Sep 2009 06:52:40 -0000 1.74 +++ modules/simpletest/simpletest.module 28 Sep 2009 22:42:43 -0000 @@ -209,7 +209,7 @@ function _simpletest_batch_operation($te } $context['message'] = t('Processed test @num of @max - %test.', array('%test' => $info['name'], '@num' => $max - $size, '@max' => $max)); $context['message'] .= '
      Overall results: ' . _simpletest_format_summary_line($test_results) . '
      '; - $context['message'] .= theme('item_list', $items); + $context['message'] .= theme('item_list', array('items' => $items)); // Save working values for the next iteration. $context['sandbox']['tests'] = $test_list; Index: modules/simpletest/simpletest.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.pages.inc,v retrieving revision 1.17 diff -u -p -r1.17 simpletest.pages.inc --- modules/simpletest/simpletest.pages.inc 18 Sep 2009 00:12:47 -0000 1.17 +++ modules/simpletest/simpletest.pages.inc 28 Sep 2009 22:42:43 -0000 @@ -63,7 +63,10 @@ function simpletest_test_form($form) { * @param $table Form array that represent a table. * @return HTML output. */ -function theme_simpletest_test_table($table) { +function theme_simpletest_test_table($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + drupal_add_css(drupal_get_path('module', 'simpletest') . '/simpletest.css'); drupal_add_js(drupal_get_path('module', 'simpletest') . '/simpletest.js'); @@ -77,8 +80,8 @@ function theme_simpletest_test_table($ta // Define the images used to expand/collapse the test groups. $js = array( 'images' => array( - theme('image', 'misc/menu-collapsed.png', 'Expand', 'Expand'), - theme('image', 'misc/menu-expanded.png', 'Collapsed', 'Collapsed'), + theme('image', array('path' => 'misc/menu-collapsed.png', 'alt' => 'Expand', 'title' => 'Expand')), + theme('image', array('path' => 'misc/menu-expanded.png', 'alt' => 'Collapsed', 'title' => 'Collapsed')), ), ); @@ -140,7 +143,7 @@ function theme_simpletest_test_table($ta $test['#name'] = $test_name; $row[] = drupal_render($test); - $row[] = theme('indentation', 1) . ''; + $row[] = theme('indentation', array('size' => 1)) . ''; $row[] = '
      ' . $description . '
      '; $rows[] = array('data' => $row, 'class' => array($test_class . '-test', ($collapsed ? 'js-hide' : ''))); @@ -156,7 +159,7 @@ function theme_simpletest_test_table($ta return '' . t('No tests to display.') . ''; } else { - return theme('table', $header, $rows, array('id' => 'simpletest-form-table')); + return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'simpletest-form-table'))); } } @@ -358,7 +361,10 @@ function simpletest_result_form_submit($ * * @return HTML output. */ -function theme_simpletest_result_summary($form) { +function theme_simpletest_result_summary($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + return '
      ' . _simpletest_format_summary_line($form) . '
      '; } @@ -398,10 +404,10 @@ function simpletest_result_status_image( if (!isset($map)) { $map = array( - 'pass' => theme('image', 'misc/watchdog-ok.png', t('Pass')), - 'fail' => theme('image', 'misc/watchdog-error.png', t('Fail')), - 'exception' => theme('image', 'misc/watchdog-warning.png', t('Exception')), - 'debug' => theme('image', 'misc/watchdog-warning.png', t('Debug')), + 'pass' => theme('image', array('path' => 'misc/watchdog-ok.png', 'alt' => t('Pass'))), + 'fail' => theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => t('Fail'))), + 'exception' => theme('image', array('path' => 'misc/watchdog-warning.png', 'alt' => t('Exception'))), + 'debug' => theme('image', array('path' => 'misc/watchdog-warning.png', 'alt' => t('Debug'))), ); } if (isset($map[$status])) { Index: modules/simpletest/tests/common_test.module =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common_test.module,v retrieving revision 1.3 diff -u -p -r1.3 common_test.module --- modules/simpletest/tests/common_test.module 5 Sep 2009 13:05:30 -0000 1.3 +++ modules/simpletest/tests/common_test.module 28 Sep 2009 22:42:43 -0000 @@ -84,7 +84,10 @@ function common_test_theme() { /** * Theme function for testing drupal_render() theming. */ -function theme_common_test_foo($foo, $bar) { +function theme_common_test_foo($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + return $foo . $bar; } Index: modules/simpletest/tests/field_test.module =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/field_test.module,v retrieving revision 1.26 diff -u -p -r1.26 field_test.module --- modules/simpletest/tests/field_test.module 27 Sep 2009 12:52:55 -0000 1.26 +++ modules/simpletest/tests/field_test.module 28 Sep 2009 22:42:43 -0000 @@ -570,7 +570,10 @@ function field_test_theme() { /** * Theme function for 'field_test_default' formatter. */ -function theme_field_formatter_field_test_default($element) { +function theme_field_formatter_field_test_default($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $value = $element['#item']['value']; $settings = $element['#settings']; @@ -580,7 +583,10 @@ function theme_field_formatter_field_tes /** * Theme function for 'field_test_multiple' formatter. */ -function theme_field_formatter_field_test_multiple($element) { +function theme_field_formatter_field_test_multiple($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + $settings = $element['#settings']; $items = array(); Index: modules/simpletest/tests/theme.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/theme.test,v retrieving revision 1.6 diff -u -p -r1.6 theme.test --- modules/simpletest/tests/theme.test 15 Sep 2009 17:10:39 -0000 1.6 +++ modules/simpletest/tests/theme.test 28 Sep 2009 22:42:43 -0000 @@ -63,14 +63,14 @@ class ThemeTableUnitTest extends DrupalW 'group' => 'Theme', ); } - + /** * Tableheader.js provides 'sticky' table headers, and is included by default. */ function testThemeTableStickyHeaders() { $header = array('one', 'two', 'three'); $rows = array(array(1,2,3), array(4,5,6), array(7,8,9)); - $this->content = theme('table', $header, $rows); + $this->content = theme('table', array('header' => $header, 'rows' => $rows)); $js = drupal_add_js(); $this->assertTrue(isset($js['misc/tableheader.js']), t('tableheader.js was included when $sticky = TRUE.')); $this->assertRaw('sticky-enabled', t('Table has a class of sticky-enabled when $sticky = TRUE.')); @@ -86,7 +86,7 @@ class ThemeTableUnitTest extends DrupalW $attributes = array(); $caption = NULL; $colgroups = array(); - $this->content = theme('table', $header, $rows, $attributes, $caption, $colgroups, FALSE); + $this->content = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => $attributes, 'caption' => $caption, 'colgroups' => $colgroups, 'sticky' => FALSE)); $js = drupal_add_js(); $this->assertFalse(isset($js['misc/tableheader.js']), t('tableheader.js was not included because $sticky = FALSE.')); $this->assertNoRaw('sticky-enabled', t('Table does not have a class of sticky-enabled because $sticky = FALSE.')); Index: modules/statistics/statistics.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.admin.inc,v retrieving revision 1.32 diff -u -p -r1.32 statistics.admin.inc --- modules/statistics/statistics.admin.inc 29 Aug 2009 03:32:46 -0000 1.32 +++ modules/statistics/statistics.admin.inc 28 Sep 2009 22:42:43 -0000 @@ -31,7 +31,7 @@ function statistics_recent_hits() { $rows[] = array( array('data' => format_date($log->timestamp, 'short'), 'class' => array('nowrap')), _statistics_format_item($log->title, $log->path), - theme('username', $log), + theme('username', array('account' => $log)), l(t('details'), "admin/reports/access/$log->aid")); } @@ -40,8 +40,8 @@ function statistics_recent_hits() { } $build['statistics_table'] = array( - '#theme' => 'table', - '#header' => $header, + '#theme' => 'table', + '#header' => $header, '#rows' => $rows, ); $build['statistics_pager'] = array('#theme' => 'pager'); @@ -88,8 +88,8 @@ function statistics_top_pages() { drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))), PASS_THROUGH); $build['statistics_top_pages_table'] = array( - '#theme' => 'table', - '#header' => $header, + '#theme' => 'table', + '#header' => $header, '#rows' => $rows, ); $build['statistics_top_pages_pager'] = array('#theme' => 'pager'); @@ -133,7 +133,7 @@ function statistics_top_visitors() { foreach ($result as $account) { $qs = drupal_get_destination(); $ban_link = $account->iid ? l(t('unblock IP address'), "admin/config/people/ip-blocking/delete/$account->iid", array('query' => $qs)) : l(t('block IP address'), "admin/config/people/ip-blocking/$account->hostname", array('query' => $qs)); - $rows[] = array($account->hits, ($account->uid ? theme('username', $account) : $account->hostname), format_interval(round($account->total / 1000)), (user_access('block IP addresses') && !$account->uid) ? $ban_link : ''); + $rows[] = array($account->hits, ($account->uid ? theme('username', array('account' => $account)) : $account->hostname), format_interval(round($account->total / 1000)), (user_access('block IP addresses') && !$account->uid) ? $ban_link : ''); } if (empty($rows)) { @@ -142,8 +142,8 @@ function statistics_top_visitors() { drupal_set_title(t('Top visitors in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))), PASS_THROUGH); $build['statistics_top_visitors_table'] = array( - '#theme' => 'table', - '#header' => $header, + '#theme' => 'table', + '#header' => $header, '#rows' => $rows, ); $build['statistics_top_visitors_pager'] = array('#theme' => 'pager'); @@ -191,8 +191,8 @@ function statistics_top_referrers() { } $build['statistics_top_referrers_table'] = array( - '#theme' => 'table', - '#header' => $header, + '#theme' => 'table', + '#header' => $header, '#rows' => $rows, ); $build['statistics_top_referrers_pager'] = array('#theme' => 'pager'); @@ -225,7 +225,7 @@ function statistics_access_log($aid) { ); $rows[] = array( array('data' => t('User'), 'header' => TRUE), - theme('username', $access) + theme('username', array('account' => $access)) ); $rows[] = array( array('data' => t('Hostname'), 'header' => TRUE), @@ -233,7 +233,7 @@ function statistics_access_log($aid) { ); $build['statistics_table'] = array( - '#theme' => 'table', + '#theme' => 'table', '#rows' => $rows, ); return $build; Index: modules/statistics/statistics.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.pages.inc,v retrieving revision 1.16 diff -u -p -r1.16 statistics.pages.inc --- modules/statistics/statistics.pages.inc 25 Aug 2009 10:27:15 -0000 1.16 +++ modules/statistics/statistics.pages.inc 28 Sep 2009 22:42:43 -0000 @@ -33,7 +33,7 @@ function statistics_node_tracker() { $rows[] = array( array('data' => format_date($log->timestamp, 'short'), 'class' => array('nowrap')), _statistics_link($log->url), - theme('username', $log), + theme('username', array('account' => $log)), l(t('details'), "admin/reports/access/$log->aid"), ); } @@ -44,8 +44,8 @@ function statistics_node_tracker() { drupal_set_title($node->title); $build['statistics_table'] = array( - '#theme' => 'table', - '#header' => $header, + '#theme' => 'table', + '#header' => $header, '#rows' => $rows ); $build['statistics_pager'] = array('#theme' => 'pager'); @@ -85,8 +85,8 @@ function statistics_user_tracker() { drupal_set_title($account->name); $build['statistics_table'] = array( - '#theme' => 'table', - '#header' => $header, + '#theme' => 'table', + '#header' => $header, '#rows' => $rows ); $build['statistics_pager'] = array('#theme' => 'pager'); Index: modules/syslog/syslog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/syslog/syslog.module,v retrieving revision 1.25 diff -u -p -r1.25 syslog.module --- modules/syslog/syslog.module 27 Aug 2009 07:18:06 -0000 1.25 +++ modules/syslog/syslog.module 28 Sep 2009 22:42:43 -0000 @@ -77,7 +77,7 @@ function syslog_watchdog(array $log_entr openlog('drupal', LOG_NDELAY, variable_get('syslog_facility', $default_facility)); } - syslog($log_entry['severity'], theme('syslog_format', $log_entry)); + syslog($log_entry['severity'], theme('syslog_format', array('entry' => $log_entry))); } function syslog_theme() { @@ -93,7 +93,10 @@ function syslog_theme() { * * @ingroup themeable */ -function theme_syslog_format($entry) { +function theme_syslog_format($variables) { + extract($variables, EXTR_SKIP); + // @todo remove extract() if possible and check hook_theme defaults. + global $base_url; $message = $base_url; Index: modules/system/page.tpl.php =================================================================== RCS file: /cvs/drupal/drupal/modules/system/page.tpl.php,v retrieving revision 1.34 diff -u -p -r1.34 page.tpl.php --- modules/system/page.tpl.php 21 Sep 2009 06:36:54 -0000 1.34 +++ modules/system/page.tpl.php 28 Sep 2009 22:42:43 -0000 @@ -49,7 +49,7 @@ * - $page['sidebar_second']: Items for the second sidebar. * - $page['header']: Items for the header region. * - $page['footer']: Items for the footer region. - * + * * @see template_preprocess() * @see template_preprocess_page() * @see template_process() @@ -96,7 +96,7 @@ @@ -135,7 +135,7 @@