';
}
/**
* Generate the HTML output for a menu link and submenu.
*
- * @param $element
- * Structured array data for a menu link.
+ * @param $variables
+ * An associative array containing:
+ * - element: Structured array data for a menu link.
+ *
+ * @return
+ * A themed HTML string.
*
* @ingroup themeable
*/
-function theme_menu_link(array $element) {
+function theme_menu_link(array $variables) {
+ $element = $variables['element'];
$sub_menu = '';
if ($element['#below']) {
@@ -1335,26 +1347,31 @@ function theme_menu_link(array $element)
/**
* Generate the HTML output for a single local task link.
*
- * @param $link
- * A menu link array with 'title', 'href', and 'localized_options' keys.
- * @param $active
- * A boolean indicating whether the local task is active.
+ * @param $variables
+ * An associative array containing:
+ * - link: A menu link array with 'title', 'href', and 'localized_options'
+ * keys.
+ * - active: A boolean indicating whether the local task is active.
*
* @ingroup themeable
*/
-function theme_menu_local_task($link, $active = FALSE) {
- return '
\n";
}
/**
* Generate the HTML output for a single local action link.
*
- * @param $link
- * A menu link array with 'title', 'href', and 'localized_options' keys.
+ * @param $variables
+ * An associative array containing:
+ * - link: A menu link array with 'title', 'href', and 'localized_options'
+ * keys.
*
* @ingroup themeable
*/
-function theme_menu_local_action($link) {
+function theme_menu_local_action($variables) {
+ $link = $variables['link'];
return '
\n";
}
@@ -1389,7 +1406,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;
@@ -1597,17 +1614,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++;
}
}
@@ -1649,14 +1666,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.73
diff -u -p -r1.73 pager.inc
--- includes/pager.inc 29 Sep 2009 15:31:13 -0000 1.73
+++ includes/pager.inc 8 Oct 2009 16:11:54 -0000
@@ -192,20 +192,25 @@ function pager_get_query_parameters() {
* retrieve a pager control so that users can view other results.
* Format a list of nearby pages with additional query results.
*
- * @param $tags
- * An array of labels for the controls in the pager.
- * @param $element
- * An optional integer to distinguish between multiple pagers on one page.
- * @param $parameters
- * An associative array of query string parameters to append to the pager links.
- * @param $quantity
- * The number of pages in the list.
+ * @param $variables
+ * An associative array containing:
+ * - tags: An array of labels for the controls in the pager.
+ * - element: An optional integer to distinguish between multiple pagers on
+ * one page.
+ * - parameters: An associative array of query string parameters to append to
+ * the pager links.
+ * - quantity: The number of pages in the list.
+ *
* @return
* An HTML string that generates the query pager.
*
* @ingroup themeable
*/
-function theme_pager($tags = array(), $element = 0, $parameters = array(), $quantity = 9) {
+function theme_pager($variables) {
+ $tags = $variables['tags'];
+ $element = $variables['element'];
+ $parameters = $variables['parameters'];
+ $quantity = $variables['quantity'];
global $pager_page_array, $pager_total;
// Calculate various markers within this pager piece:
@@ -235,10 +240,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 +272,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 +284,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 +308,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'))));
}
}
@@ -318,24 +323,29 @@ function theme_pager($tags = array(), $e
/**
* Format a "first page" link.
*
- * @param $text
- * The name (or image) of the link.
- * @param $element
- * An optional integer to distinguish between multiple pagers on one page.
- * @param $parameters
- * An associative array of query string parameters to append to the pager links.
+ * @param $variables
+ * An associative array containing:
+ * - text: The name (or image) of the link.
+ * - element: An optional integer to distinguish between multiple pagers on
+ * one page.
+ * - parameters: An associative array of query string parameters to append to
+ * the pager links.
+ *
* @return
* An HTML string that generates this piece of the query pager.
*
* @ingroup themeable
*/
-function theme_pager_first($text, $element = 0, $parameters = array()) {
+function theme_pager_first($variables) {
+ $text = $variables['text'];
+ $element = $variables['element'];
+ $parameters = $variables['parameters'];
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;
@@ -344,20 +354,25 @@ function theme_pager_first($text, $eleme
/**
* Format a "previous page" link.
*
- * @param $text
- * The name (or image) of the link.
- * @param $element
- * An optional integer to distinguish between multiple pagers on one page.
- * @param $interval
- * The number of pages to move backward when the link is clicked.
- * @param $parameters
- * An associative array of query string parameters to append to the pager links.
+ * @param $variables
+ * An associative array containing:
+ * - text: The name (or image) of the link.
+ * - element: An optional integer to distinguish between multiple pagers on
+ * one page.
+ * - interval: The number of pages to move backward when the link is clicked.
+ * - parameters: An associative array of query string parameters to append to
+ * the pager links.
+ *
* @return
* An HTML string that generates this piece of the query pager.
*
* @ingroup themeable
*/
-function theme_pager_previous($text, $element = 0, $interval = 1, $parameters = array()) {
+function theme_pager_previous($variables) {
+ $text = $variables['text'];
+ $element = $variables['element'];
+ $interval = $variables['interval'];
+ $parameters = $variables['parameters'];
global $pager_page_array;
$output = '';
@@ -367,11 +382,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));
}
}
@@ -381,20 +396,25 @@ function theme_pager_previous($text, $el
/**
* Format a "next page" link.
*
- * @param $text
- * The name (or image) of the link.
- * @param $element
- * An optional integer to distinguish between multiple pagers on one page.
- * @param $interval
- * The number of pages to move forward when the link is clicked.
- * @param $parameters
- * An associative array of query string parameters to append to the pager links.
+ * @param $variables
+ * An associative array containing:
+ * - text: The name (or image) of the link.
+ * - element: An optional integer to distinguish between multiple pagers on
+ * one page.
+ * - interval: The number of pages to move forward when the link is clicked.
+ * - parameters: An associative array of query string parameters to append to
+ * the pager links.
+ *
* @return
* An HTML string that generates this piece of the query pager.
*
* @ingroup themeable
*/
-function theme_pager_next($text, $element = 0, $interval = 1, $parameters = array()) {
+function theme_pager_next($variables) {
+ $text = $variables['text'];
+ $element = $variables['element'];
+ $interval = $variables['interval'];
+ $parameters = $variables['parameters'];
global $pager_page_array, $pager_total;
$output = '';
@@ -403,11 +423,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));
}
}
@@ -417,24 +437,29 @@ function theme_pager_next($text, $elemen
/**
* Format a "last page" link.
*
- * @param $text
- * The name (or image) of the link.
- * @param $element
- * An optional integer to distinguish between multiple pagers on one page.
- * @param $parameters
- * An associative array of query string parameters to append to the pager links.
+ * @param $variables
+ * An associative array containing:
+ * - text: The name (or image) of the link.
+ * - element: An optional integer to distinguish between multiple pagers on
+ * one page.
+ * - parameters: An associative array of query string parameters to append to
+ * the pager links.
+ *
* @return
* An HTML string that generates this piece of the query pager.
*
* @ingroup themeable
*/
-function theme_pager_last($text, $element = 0, $parameters = array()) {
+function theme_pager_last($variables) {
+ $text = $variables['text'];
+ $element = $variables['element'];
+ $parameters = $variables['parameters'];
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;
@@ -444,20 +469,28 @@ function theme_pager_last($text, $elemen
/**
* Format a link to a specific query result page.
*
- * @param $page_new
- * The first result to display on the linked page.
- * @param $element
- * An optional integer to distinguish between multiple pagers on one page.
- * @param $parameters
- * An associative array of query string parameters to append to the pager link.
- * @param $attributes
- * An associative array of HTML attributes to apply to a pager anchor tag.
+ * @param $variables
+ * An associative array containing:
+ * - page_new: The first result to display on the linked page.
+ * - element: An optional integer to distinguish between multiple pagers on
+ * one page.
+ * - parameters: An associative array of query string parameters to append to
+ * the pager link.
+ * - attributes: An associative array of HTML attributes to apply to a pager
+ * anchor tag.
+ *
* @return
* An HTML string that generates the link.
*
* @ingroup themeable
*/
-function theme_pager_link($text, $page_new, $element, $parameters = array(), $attributes = array()) {
+function theme_pager_link($variables) {
+ $text = $variables['text'];
+ $page_new = $variables['page_new'];
+ $element = $variables['element'];
+ $parameters = $variables['parameters'];
+ $attributes = $variables['attributes'];
+
$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.55
diff -u -p -r1.55 tablesort.inc
--- includes/tablesort.inc 29 Sep 2009 15:31:13 -0000 1.55
+++ includes/tablesort.inc 8 Oct 2009 16:11:54 -0000
@@ -169,7 +169,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.531
diff -u -p -r1.531 theme.inc
--- includes/theme.inc 5 Oct 2009 02:43:01 -0000 1.531
+++ includes/theme.inc 8 Oct 2009 16:11:54 -0000
@@ -609,12 +609,10 @@ function list_themes($refresh = FALSE) {
* registry is checked to determine which implementation to use, which may
* be a function or a template.
*
- * If the implementation is a template, the arguments are converted to a
- * $variables array. This array is then modified by the module implementing
- * the hook, theme engine (if applicable) and the theme. The following
- * functions may be used to modify the $variables array. They are processed in
- * two distinct phases; "preprocess" and "process" functions. The order it is
- * listed here is the order in which it will execute.
+ * If the implementation is a template, the following functions may be used to
+ * modify the $variables array. They are processed in two distinct phases;
+ * "preprocess" and "process" functions. The order listed here is the order in
+ * which they execute.
*
* - template_preprocess(&$variables)
* This sets a default set of variables for all template implementations.
@@ -705,21 +703,9 @@ function list_themes($refresh = FALSE) {
*
* If the implementation is a function, only the hook-specific preprocess
* and process functions (the ones ending in _HOOK) are called from the
- * above list. There are two reasons why the non-hook-specific preprocess
- * and process functions (the ones not ending in _HOOK) are not called for
- * function-implemented theme hooks:
- *
- * - Function-implemented theme hooks need to be fast, and calling the
- * non-hook-specific preprocess and process functions on them would incur
- * a noticeable performance penalty.
- *
- * - Function-implemented theme hooks can only make use of variables
- * declared as arguments within the hook_theme() function that registers
- * the theme hook, and cannot make use of additional generic variables.
- * For the most part, non-hook-specific preprocess and process functions
- * add/modify variables other than the theme hook's arguments, variables
- * that are potentially useful in template files, but unavailable to
- * function implementations.
+ * above list. This is because theme hooks with function implementations
+ * need to be fast, and calling the non-hook-specific preprocess and process
+ * functions for them would incur a noticeable performance penalty.
*
* For template-implemented theme hooks, there are two special variables that
* these preprocess and process functions can set:
@@ -746,21 +732,26 @@ function list_themes($refresh = FALSE) {
* so that if the specific theme hook isn't implemented anywhere, a more
* generic one will be used. This can allow themes to create specific theme
* implementations for named objects.
- * @param ...
- * Additional arguments to pass along to the theme function.
+ *
+ * @param $variables
+ * An associative array of variables to merge with defaults from the theme
+ * registry, pass to preprocess and process functions for modification, and
+ * finally, pass to the function or template implementing the theme hook.
+ * Alternatively, this can be a renderable array, in which case, its properties
+ * are mapped to variables expected by the theme hook implementations.
+ *
* @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();
$hooks = theme_get_registry();
}
+ // If an array of hook candidates were passed, use the first one that has an
+ // implementation.
if (is_array($hook)) {
foreach ($hook as $candidate) {
if (isset($hooks[$candidate])) {
@@ -786,99 +777,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';
@@ -898,44 +868,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;
@@ -1288,11 +1246,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
@@ -1344,30 +1303,37 @@ function theme_render_template($template
* Formats text for emphasized display in a placeholder inside a sentence.
* Used automatically by t().
*
- * @param $text
- * The text to format (plain-text).
+ * @param $variables
+ * An associative array containing:
+ * - text: The text to format (plain-text).
+ *
* @return
* The formatted text (html).
*/
-function theme_placeholder($text) {
- return '' . check_plain($text) . '';
+function theme_placeholder($variables) {
+ return '' . check_plain($variables['text']) . '';
}
/**
* Return a themed set of status and/or error messages. The messages are grouped
* by type.
*
- * An invisible heading identifies the messages for assistive technology. Sighted
- * users see a colored box. See http://www.w3.org/TR/WCAG-TECHS/H69.html for info.
+ * An invisible heading identifies the messages for assistive technology.
+ * Sighted users see a colored box. See http://www.w3.org/TR/WCAG-TECHS/H69.html
+ * for info.
*
- * @param $display
- * (optional) Set to 'status' or 'error' to display only messages of that type.
+ * @param $variables
+ * An associative array containing:
+ * - display: (optional) Set to 'status' or 'error' to display only messages
+ * of that type.
*
* @return
* A string containing the messages.
*/
-function theme_status_messages($display = NULL) {
+function theme_status_messages($variables) {
+ $display = $variables['display'];
$output = '';
+
$status_heading = array(
'status' => t('Status message'),
'error' => t('Error message'),
@@ -1396,34 +1362,41 @@ function theme_status_messages($display
/**
* Return a themed set of links.
*
- * @param $links
- * A keyed array of links to be themed. The key for each link is used as its css class.
- * Each link should be itself an array, with the following keys:
- * - title: the link text
- * - href: the link URL. If omitted, the 'title' is shown as a plain text item in the links list.
- * - html: (optional) set this to TRUE if 'title' is HTML so it will be escaped.
- * Array items are passed on to the l() function's $options parameter when creating the link.
- * @param $attributes
- * A keyed array of attributes.
- * @param $heading
- * An optional keyed array or a string for a heading to precede the links.
- * When using an array the following keys can be used:
- * - text: the heading text
- * - level: the heading level (e.g. 'h2', 'h3')
- * - class: (optional) an array of the CSS classes for the heading
- * When using a string it will be used as the text of the heading and the
- * level will default to 'h2'.
- * Headings should be used on navigation menus and any list of links that
- * consistently appears on multiple pages. To make the heading invisible
- * use the 'element-invisible' CSS class. Do not use 'display:none', which
- * removes it from screen-readers and assistive technology. Headings allow
- * screen-reader and keyboard only users to navigate to or skip the links.
- * See http://juicystudio.com/article/screen-readers-display-none.php
- * and http://www.w3.org/TR/WCAG-TECHS/H42.html for more information.
+ * @param $variables
+ * An associative array containing:
+ * - links: A keyed array of links to be themed. The key for each link is used
+ * as its css class. Each link should be itself an array, with the following
+ * keys:
+ * - title: the link text
+ * - href: the link URL. If omitted, the 'title' is shown as a plain text
+ * item in the links list.
+ * - html: (optional) set this to TRUE if 'title' is HTML so it will be
+ * escaped.
+ * Array items are passed on to the l() function's $options parameter when
+ * creating the link.
+ * - attributes: A keyed array of attributes.
+ * - heading: An optional keyed array or a string for a heading to precede the
+ * links. When using an array the following keys can be used:
+ * - text: the heading text
+ * - level: the heading level (e.g. 'h2', 'h3')
+ * - class: (optional) an array of the CSS classes for the heading
+ * When using a string it will be used as the text of the heading and the
+ * level will default to 'h2'.
+ * Headings should be used on navigation menus and any list of links that
+ * consistently appears on multiple pages. To make the heading invisible
+ * use the 'element-invisible' CSS class. Do not use 'display:none', which
+ * removes it from screen-readers and assistive technology. Headings allow
+ * screen-reader and keyboard only users to navigate to or skip the links.
+ * See http://juicystudio.com/article/screen-readers-display-none.php
+ * and http://www.w3.org/TR/WCAG-TECHS/H42.html for more information.
+ *
* @return
* A string containing an unordered list of links.
*/
-function theme_links($links, $attributes = array('class' => array('links')), $heading = array()) {
+function theme_links($variables) {
+ $links = $variables['links'];
+ $attributes = $variables['attributes'];
+ $heading = $variables['heading'];
global $language;
$output = '';
@@ -1499,20 +1472,27 @@ function theme_links($links, $attributes
/**
* Return a themed image.
*
- * @param $path
- * Either the path of the image file (relative to base_path()) or a full URL.
- * @param $alt
- * The alternative text for text-based browsers.
- * @param $title
- * The title text is displayed when the image is hovered in some popular browsers.
- * @param $attributes
- * Associative array of attributes to be placed in the img tag.
- * @param $getsize
- * If set to TRUE, the image's dimension are fetched and added as width/height attributes.
+ * @param $variables
+ * An associative array containing:
+ * - path: Either the path of the image file (relative to base_path()) or a
+ * full URL.
+ * - alt: The alternative text for text-based browsers.
+ * - title: The title text is displayed when the image is hovered in some
+ * popular browsers.
+ * - attributes: Associative array of attributes to be placed in the img tag.
+ * - getsize: If set to TRUE, the image's dimension are fetched and added as
+ * width/height attributes.
+ *
* @return
* A string containing the image tag.
*/
-function theme_image($path, $alt = '', $title = '', $attributes = array(), $getsize = TRUE) {
+function theme_image($variables) {
+ $path = $variables['path'];
+ $alt = $variables['alt'];
+ $title = $variables['title'];
+ $attributes = $variables['attributes'];
+ $getsize = $variables['getsize'];
+
if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path)))) {
$attributes = drupal_attributes($attributes);
$url = file_create_url($path);
@@ -1523,11 +1503,16 @@ function theme_image($path, $alt = '', $
/**
* Return a themed breadcrumb trail.
*
- * @param $breadcrumb
- * An array containing the breadcrumb links.
- * @return a string containing the breadcrumb output.
+ * @param $variables
+ * An associative array containing:
+ * - breadcrumb: 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.
@@ -1541,89 +1526,97 @@ function theme_breadcrumb($breadcrumb) {
/**
* Return a themed submenu, typically displayed under the tabs.
*
- * @param $links
- * An array of links.
+ * @param $variables
+ * An associative array containing:
+ * - links: An array of links.
*/
-function theme_submenu($links) {
+function theme_submenu($variables) {
+ $links = $variables['links'];
+
return '
' . implode(' | ', $links) . '
';
}
/**
* Return a themed table.
*
- * @param $header
- * An array containing the table headers. Each element of the array can be
- * either a localized string or an associative array with the following keys:
- * - "data": The localized title of the table column.
- * - "field": The database field represented in the table column (required if
- * user is to be able to sort on this column).
- * - "sort": A default sort order for this column ("asc" or "desc").
- * - Any HTML attributes, such as "colspan", to apply to the column header cell.
- * @param $rows
- * An array of table rows. Every row is an array of cells, or an associative
- * array with the following keys:
- * - "data": an array of cells
- * - Any HTML attributes, such as "class", to apply to the table row.
- *
- * Each cell can be either a string or an associative array with the following keys:
- * - "data": The string to display in the table cell.
- * - "header": Indicates this cell is a header.
- * - Any HTML attributes, such as "colspan", to apply to the table cell.
- *
- * Here's an example for $rows:
- * @verbatim
- * $rows = array(
- * // Simple row
- * array(
- * 'Cell 1', 'Cell 2', 'Cell 3'
- * ),
- * // Row with attributes on the row and some of its cells.
- * array(
- * 'data' => array('Cell 1', array('data' => 'Cell 2', 'colspan' => 2)), 'class' => array('funky')
- * )
- * );
- * @endverbatim
- *
- * @param $attributes
- * An array of HTML attributes to apply to the table tag.
- * @param $caption
- * A localized string to use for the
tag.
- * @param $colgroups
- * An array of column groups. Each element of the array can be either:
- * - An array of columns, each of which is an associative array of HTML attributes
- * applied to the COL element.
- * - An array of attributes applied to the COLGROUP element, which must include a
- * "data" attribute. To add attributes to COL elements, set the "data" attribute
- * with an array of columns, each of which is an associative array of HTML attributes.
- * Here's an example for $colgroup:
- * @verbatim
- * $colgroup = array(
- * // COLGROUP with one COL element.
- * array(
+ * @param $variables
+ * An associative array containing:
+ * - header: An array containing the table headers. Each element of the array
+ * can be either a localized string or an associative array with the
+ * following keys:
+ * - "data": The localized title of the table column.
+ * - "field": The database field represented in the table column (required
+ * if user is to be able to sort on this column).
+ * - "sort": A default sort order for this column ("asc" or "desc").
+ * - Any HTML attributes, such as "colspan", to apply to the column header
+ * cell.
+ * - rows: An array of table rows. Every row is an array of cells, or an
+ * associative array with the following keys:
+ * - "data": an array of cells
+ * - Any HTML attributes, such as "class", to apply to the table row.
+ * Each cell can be either a string or an associative array with the
+ * following keys:
+ * - "data": The string to display in the table cell.
+ * - "header": Indicates this cell is a header.
+ * - Any HTML attributes, such as "colspan", to apply to the table cell.
+ * Here's an example for $rows:
+ * @verbatim
+ * $rows = array(
+ * // Simple row
* array(
- * 'class' => array('funky'), // Attribute for the COL element.
+ * 'Cell 1', 'Cell 2', 'Cell 3'
* ),
- * ),
- * // Colgroup with attributes and inner COL elements.
- * array(
- * 'data' => array(
+ * // Row with attributes on the row and some of its cells.
+ * array(
+ * 'data' => array('Cell 1', array('data' => 'Cell 2', 'colspan' => 2)), 'class' => array('funky')
+ * )
+ * );
+ * @endverbatim
+ * - attributes: An array of HTML attributes to apply to the table tag.
+ * - caption: A localized string to use for the
tag.
+ * - colgroups: An array of column groups. Each element of the array can be
+ * either:
+ * - An array of columns, each of which is an associative array of HTML
+ * attributes applied to the COL element.
+ * - An array of attributes applied to the COLGROUP element, which must
+ * include a "data" attribute. To add attributes to COL elements, set the
+ * "data" attribute with an array of columns, each of which is an
+ * associative array of HTML attributes.
+ * Here's an example for $colgroup:
+ * @verbatim
+ * $colgroup = array(
+ * // COLGROUP with one COL element.
+ * array(
* array(
* 'class' => array('funky'), // Attribute for the COL element.
* ),
* ),
- * 'class' => array('jazzy'), // Attribute for the COLGROUP element.
- * ),
- * );
- * @endverbatim
- * These optional tags are used to group and set properties on columns
- * within a table. For example, one may easily group three columns and
- * apply same background style to all.
- * @param $sticky
- * Use a "sticky" table header.
+ * // Colgroup with attributes and inner COL elements.
+ * array(
+ * 'data' => array(
+ * array(
+ * 'class' => array('funky'), // Attribute for the COL element.
+ * ),
+ * ),
+ * 'class' => array('jazzy'), // Attribute for the COLGROUP element.
+ * ),
+ * );
+ * @endverbatim
+ * These optional tags are used to group and set properties on columns
+ * within a table. For example, one may easily group three columns and
+ * apply same background style to all.
+ * - sticky: Use a "sticky" table header.
+ *
* @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) {
@@ -1747,17 +1740,19 @@ function theme_table_select_header_cell(
/**
* Return a themed sort icon.
*
- * @param $style
- * Set to either asc or desc. This sets which icon to show.
+ * @param $variables
+ * An associative array containing:
+ * - style: Set to either asc or desc. This sets which icon to show.
+ *
* @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')));
}
}
@@ -1765,13 +1760,16 @@ function theme_tablesort_indicator($styl
* Return a themed marker, useful for marking new or updated
* content.
*
- * @param $type
- * Number representing the marker type to display
- * @see MARK_NEW, MARK_UPDATED, MARK_READ
+ * @param $variables
+ * An associative array containing:
+ * - type: Number representing the marker type to display.
+ * @see MARK_NEW, MARK_UPDATED, MARK_READ
+ *
* @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) {
@@ -1786,22 +1784,27 @@ function theme_mark($type = MARK_NEW) {
/**
* Return a themed list of items.
*
- * @param $items
- * An array of items to be displayed in the list. If an item is a string,
- * then it is used as is. If an item is an array, then the "data" element of
- * the array is used as the contents of the list item. If an item is an array
- * with a "children" element, those children are displayed in a nested list.
- * All other elements are treated as attributes of the list item element.
- * @param $title
- * The title of the list.
- * @param $type
- * The type of list to return (e.g. "ul", "ol")
- * @param $attributes
- * The attributes applied to the list element.
+ * @param $variables
+ * An associative array containing:
+ * - items: An array of items to be displayed in the list. If an item is a
+ * string, then it is used as is. If an item is an array, then the "data"
+ * element of the array is used as the contents of the list item. If an item
+ * is an array with a "children" element, those children are displayed in a
+ * nested list. All other elements are treated as attributes of the list
+ * item element.
+ * - title: The title of the list.
+ * - type: The type of list to return (e.g. "ul", "ol").
+ * - attributes: The attributes applied to the list element.
+ *
* @return
* A string containing the list output.
*/
-function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = array()) {
+function theme_item_list($variables) {
+ $items = $variables['items'];
+ $title = $variables['title'];
+ $type = $variables['type'];
+ $attributes = $variables['attributes'];
+
$output = '
';
if (isset($title)) {
$output .= '
' . $title . '
';
@@ -1849,92 +1852,89 @@ function theme_item_list($items = array(
/**
* Returns code that emits the 'more help'-link.
*/
-function theme_more_help_link($url) {
- return '
';
}
/**
* Return code that emits an feed icon.
*
- * @param $url
- * The url of the feed.
- * @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 . '';
+ * @param $variables
+ * An associative array containing:
+ * - url: The url of the feed.
+ * - title: A descriptive title of the feed.
+ */
+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 . '';
}
}
/**
* Returns code that emits the 'more' link used on blocks.
*
- * @param $url
- * The url of the main page
- * @param $title
- * A descriptive verb for the link, like 'Read more'
+ * @param $variables
+ * An associative array containing:
+ * - url: The url of the main page
+ * - title: A descriptive verb for the link, like 'Read more'
*/
-function theme_more_link($url, $title) {
- 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']);
}
/**
@@ -1946,38 +1946,45 @@ 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'];
}
}
/**
* Format a username.
*
- * @param $object
- * The user object to format, which has been processed to provide safe and
- * standarized elements. The object keys 'name', and 'extra' are safe strings
- * that can be used directly.
+ * @param $variables
+ * An associative array containing:
+ * - account: The user object to format.
+ * - name: The user's name, sanitized.
+ * - extra: Additional text to append to the user's name, sanitized.
+ * - link_path: The path or URL of the user's profile page, home page, or
+ * other desired page to link to for more information about the user.
+ * - link_options: An array of options to pass to the l() function's $options
+ * parameter if linking the user's name to the user's page.
+ * - attributes_array: An array of attributes to pass to the
+ * drupal_attributes() function if not linking to the user's page.
*
* @return
- * A string containing an HTML link to the user's page if the passed object
- * suggests that this is a site user. Otherwise, only the username is returned.
+ * A themed HTML string containing the user's name, potentially linked to the
+ * user's page.
*
* @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;
}
@@ -1985,18 +1992,19 @@ function theme_username($object) {
/**
* Return a themed progress bar.
*
- * @param $percent
- * The percentage of the progress.
- * @param $message
- * A string containing information to be displayed.
+ * @param $variables
+ * An associative array containing:
+ * - percent: The percentage of the progress.
+ * - message: A string containing information to be displayed.
+ *
* @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;
@@ -2005,14 +2013,16 @@ function theme_progress_bar($percent, $m
/**
* Create a standard indentation div. Used for drag and drop tables.
*
- * @param $size
- * Optional. The number of indentations to create.
+ * @param $variables
+ * An associative array containing:
+ * - size: Optional. The number of indentations to create.
+ *
* @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 .= '
';
$output .= '';
@@ -115,14 +118,13 @@ function theme_task_list($items, $active
*
* Note: this function is not themeable.
*
- * @param $content
- * The page content to show.
+ * @param $variables
+ * An associative array containing:
+ * - content: The page content to show.
*/
-function theme_install_page($content) {
+function theme_install_page($variables) {
drupal_add_http_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 +138,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'] .= '
' . st('Please check the error messages and try again.', array('!url' => request_uri())) . '
';
}
@@ -144,14 +146,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
@@ -168,19 +170,16 @@ function theme_install_page($content) {
*
* Note: this function is not themeable.
*
- * @param $content
- * The page content to show.
- * @param $show_messages
- * Whether to output status and error messages.
- * FALSE can be useful to postpone the messages to a subsequent page.
+ * @param $variables
+ * An associative array containing:
+ * - content: The page content to show.
+ * - show_messages: 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_add_http_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 +191,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 8 Oct 2009 16:11:55 -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 8 Oct 2009 16:11:55 -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;
}
@@ -642,19 +642,18 @@ function aggregator_category_load($cid)
/**
* Format an individual feed item for display in the block.
*
- * @param $item
- * The item to be displayed.
- * @param $feed
- * Not used.
+ * @param $variables
+ * An associative array containing:
+ * - item: The item to be displayed.
+ * - feed: Not used.
+ *
* @return
* The item HTML.
* @ingroup themeable
*/
-function theme_aggregator_block_item($item, $feed = 0) {
-
+function theme_aggregator_block_item($variables) {
// Display the external link to the item.
- return '' . check_plain($item->title) . "\n";
-
+ return '' . check_plain($variables['item']->title) . "\n";
}
/**
Index: modules/aggregator/aggregator.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.pages.inc,v
retrieving revision 1.36
diff -u -p -r1.36 aggregator.pages.inc
--- modules/aggregator/aggregator.pages.inc 30 Sep 2009 18:36:02 -0000 1.36
+++ modules/aggregator/aggregator.pages.inc 8 Oct 2009 16:11:55 -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();
@@ -229,13 +229,17 @@ function aggregator_categorize_items_sub
/**
* Theme the page list form for assigning categories.
*
- * @param $form
- * An associative array containing the structure of the form.
+ * @param $variables
+ * An associative array containing:
+ * - form: An associative array containing the structure of the form.
+ *
* @return
* The output HTML.
* @ingroup themeable
*/
-function theme_aggregator_categorize_items($form) {
+function theme_aggregator_categorize_items($variables) {
+ $form = $variables['form'];
+
$output = drupal_render($form['feed_source']);
$rows = array();
if (!empty($form['items'])) {
@@ -246,11 +250,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 +263,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 +310,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 +333,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,19 +360,23 @@ function aggregator_page_rss() {
}
$feeds = $result->fetchAll();
- return theme('aggregator_page_rss', $feeds, $category);
+ return theme('aggregator_page_rss', array('feeds' => $feeds, 'category' => $category));
}
/**
* Theme the RSS output.
*
- * @param $feeds
- * An array of the feeds to theme.
- * @param $category
- * A common category, if any, for all the feeds.
+ * @param $variables
+ * An associative array containing:
+ * - feeds: An array of the feeds to theme.
+ * - category: 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) {
+ $feeds = $variables['feeds'];
+ $category = $variables['category'];
+
drupal_add_http_header('Content-Type', 'application/rss+xml; charset=utf-8');
$items = '';
@@ -418,17 +426,21 @@ function aggregator_page_opml($cid = NUL
}
$feeds = $result->fetchAll();
- return theme('aggregator_page_opml', $feeds);
+ return theme('aggregator_page_opml', array('feeds' => $feeds));
}
/**
* Theme the OPML feed output.
*
- * @param $feeds
- * An array of the feeds to theme.
+ * @param $variables
+ * An associative array containing:
+ * - feeds: An array of the feeds to theme.
+ *
* @ingroup themeable
*/
-function theme_aggregator_page_opml($feeds) {
+function theme_aggregator_page_opml($variables) {
+ $feeds = $variables['feeds'];
+
drupal_add_http_header('Content-Type', 'text/xml; charset=utf-8');
$output = "\n";
@@ -454,7 +466,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 +498,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 8 Oct 2009 16:11:55 -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 = '';
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 8 Oct 2009 16:11:55 -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 8 Oct 2009 16:11:55 -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 8 Oct 2009 16:11:55 -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,9 @@ function _book_admin_table_tree($tree, &
* @ingroup themeable
* @see book_admin_table()
*/
-function theme_book_admin_table($form) {
+function theme_book_admin_table($variables) {
+ $form = $variables['form'];
+
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 +242,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 +257,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.516
diff -u -p -r1.516 book.module
--- modules/book/book.module 29 Sep 2009 15:31:14 -0000 1.516
+++ modules/book/book.module 8 Oct 2009 16:11:55 -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,9 @@ function book_block_save($delta = '', $e
*
* @ingroup themeable
*/
-function theme_book_title_link($link) {
+function theme_book_title_link($variables) {
+ $link = $variables['link'];
+
$link['options']['attributes']['class'] = array('book-title');
return l($link['title'], $link['href'], $link['options']);
@@ -737,7 +739,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 +1089,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 8 Oct 2009 16:11:55 -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 8 Oct 2009 16:11:55 -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,9 @@ function color_scheme_form($form, &$form
*
* @ingroup themeable
*/
-function theme_color_scheme_form($form) {
+function theme_color_scheme_form($variables) {
+ $form = $variables['form'];
+
$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 8 Oct 2009 16:11:55 -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.775
diff -u -p -r1.775 comment.module
--- modules/comment/comment.module 29 Sep 2009 15:31:14 -0000 1.775
+++ modules/comment/comment.module 8 Oct 2009 16:11:55 -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';
@@ -2137,11 +2137,14 @@ function template_preprocess_comment(&$v
/**
* Theme a "you can't post comments" notice.
*
- * @param $node
- * The comment node.
+ * @param $variables
+ * An associative array containing:
+ * - node: The comment node.
+ *
* @ingroup themeable
*/
-function theme_comment_post_forbidden($node) {
+function theme_comment_post_forbidden($variables) {
+ $node = $variables['node'];
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 8 Oct 2009 16:11:55 -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.26
diff -u -p -r1.26 contact.pages.inc
--- modules/contact/contact.pages.inc 29 Sep 2009 15:31:14 -0000 1.26
+++ modules/contact/contact.pages.inc 8 Oct 2009 16:11:55 -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 8 Oct 2009 16:11:55 -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 8 Oct 2009 16:11:55 -0000
@@ -173,8 +173,10 @@ function dblog_form_system_logging_setti
*
* @ingroup themeable
*/
-function theme_dblog_filters($form) {
+function theme_dblog_filters($variables) {
+ $form = $variables['form'];
$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.37
diff -u -p -r1.37 field.api.php
--- modules/field/field.api.php 30 Sep 2009 12:26:36 -0000 1.37
+++ modules/field/field.api.php 8 Oct 2009 16:11:55 -0000
@@ -778,21 +778,22 @@ function hook_field_formatter_info_alter
* value (the hook_field_formatter_info() entry uses
* 'multiple values' = FIELD_BEHAVIOR_DEFAULT).
*
- * @param $element
- * A render structure sub-array, containing the following keys:
- * - #item: The field value being displayed.
- * - #delta: The index of the value being displayed within the object(s values
- * for the field.
- * - #field_name: The name of the field being displayed.
- * - #bundle: The bundle of the object being displayed.
- * - #object: The object being displayed.
- * - #object_type: The type of the object being displayed.
- * - #formatter: The name of the formatter being used.
- * - #settings: The array of formatter settings.
+ * @param $variables
+ * An associative array containing:
+ * - element: A render structure sub-array, containing the following keys:
+ * - #item: The field value being displayed.
+ * - #delta: The index of the value being displayed within the object's
+ * values for the field.
+ * - #field_name: The name of the field being displayed.
+ * - #bundle: The bundle of the object being displayed.
+ * - #object: The object being displayed.
+ * - #object_type: The type of the object being displayed.
+ * - #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) {
// This relies on a 'safe' element being prepared in hook_field_sanitize().
- return $element['#item']['safe'];
+ return $variables['element']['#item']['safe'];
}
/**
@@ -802,17 +803,20 @@ function theme_field_formatter_FORMATTER
* (the hook_field_formatter_info() entry uses
* 'multiple values' = FIELD_BEHAVIOR_CUSTOM).
*
- * @param $element
- * A render structure sub-array, containing the following keys:
- * - #field_name: The name of the field being displayed.
- * - #bundle: The bundle of the object being displayed.
- * - #object: The object being displayed.
- * - #object_type: The type of the object being displayed.
- * - #formatter: The name of the formatter being used.
- * - #settings: The array of formatter settings.
- * - numeric indexes: the field values being displayed.
+ * @param $variables
+ * An associative array containing:
+ * - element: A render structure sub-array, containing the following keys:
+ * - #field_name: The name of the field being displayed.
+ * - #bundle: The bundle of the object being displayed.
+ * - #object: The object being displayed.
+ * - #object_type: The type of the object being displayed.
+ * - #formatter: The name of the formatter being used.
+ * - #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) {
+ $element = $variables['element'];
+
$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.26
diff -u -p -r1.26 field.form.inc
--- modules/field/field.form.inc 29 Sep 2009 01:08:35 -0000 1.26
+++ modules/field/field.form.inc 8 Oct 2009 16:11:55 -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) {
+ $element = $variables['element'];
$output = '';
if ($element['#cardinality'] > 1 || $element['#cardinality'] == FIELD_CARDINALITY_UNLIMITED) {
@@ -268,7 +269,7 @@ function theme_field_multiple_value_form
}
$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 8 Oct 2009 16:11:55 -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 8 Oct 2009 16:11:55 -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'];
@@ -493,12 +495,13 @@ function number_decimal_validate($elemen
* FAPI theme for an individual number element.
*
* The textfield is already rendered by the textfield
- * theme and the HTML output lives in $element['#children'].
+ * theme and the HTML output lives in $variables['element']['#children'].
* Override this theme to make custom changes to the output.
*
- * $element['#field_name'] contains the field name
- * $element['#delta] is the position of this element in the group
+ * $variables['element']['#field_name'] contains the field name
+ * $variables['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 8 Oct 2009 16:11:55 -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':
@@ -405,20 +406,23 @@ function theme_options_none($instance) {
*
* The select, checkboxes or radios are already rendered by the
* select, checkboxes, or radios themes and the HTML output
- * lives in $element['#children']. Override this theme to
+ * lives in $variables['element']['#children']. Override this theme to
* make custom changes to the output.
*
- * $element['#field_name'] contains the field name
- * $element['#delta] is the position of this element in the group
+ * $variables['element']['#field_name'] contains the field name
+ * $variables['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 8 Oct 2009 16:11:55 -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']);
@@ -774,16 +778,18 @@ function text_field_widget_formatted_tex
*
* The textfield or textarea is already rendered by the
* textfield or textarea themes and the html output
- * lives in $element['#children']. Override this theme to
+ * lives in $variables['element']['#children']. Override this theme to
* make custom changes to the output.
*
- * $element['#field_name'] contains the field name
- * $element['#delta] is the position of this element in the group
+ * $variables['element']['#field_name'] contains the field name
+ * $variables['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.21
diff -u -p -r1.21 field_ui.admin.inc
--- modules/field_ui/field_ui.admin.inc 2 Oct 2009 14:39:43 -0000 1.21
+++ modules/field_ui/field_ui.admin.inc 8 Oct 2009 16:11:55 -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');
}
}
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 8 Oct 2009 16:11:55 -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,8 +746,10 @@ function file_field_widget_process_multi
/**
* Theme an individual file upload widget.
*/
-function theme_file_widget($element) {
+function theme_file_widget($variables) {
+ $element = $variables['element'];
$output = '';
+
// The "form-managed-file" class is required for proper AJAX functionality.
$output .= '
';
if ($element['fid']['#value'] != 0) {
@@ -763,7 +765,9 @@ function theme_file_widget($element) {
/**
* Theme a group of file upload widgets.
*/
-function theme_file_widget_multiple($element) {
+function theme_file_widget_multiple($variables) {
+ $element = $variables['element'];
+
$field = field_info_field($element['#field_name']);
// Get our list of widgets in order.
@@ -840,7 +844,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;
}
@@ -848,14 +852,20 @@ function theme_file_widget_multiple($ele
/**
* Generate help text based on upload validators.
*
- * @param $description
- * The normal description for this field, specified by the user.
- * @param $upload_validators
- * An array of upload validators as used in $element['#upload_validators'].
+ * @param $variables
+ * An associative array containing:
+ * - description: The normal description for this field, specified by the
+ * user.
+ * - upload_validators: An array of upload validators as used in
+ * $element['#upload_validators'].
+ *
* @return
* A string suitable for a file field description.
*/
-function theme_file_upload_help($description, $upload_validators) {
+function theme_file_upload_help($variables) {
+ $description = $variables['description'];
+ $upload_validators = $variables['upload_validators'];
+
$descriptions = array();
if (strlen($description)) {
@@ -890,29 +900,33 @@ 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) {
+ $element = $variables['element'];
+ 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) {
+ $element = $variables['element'];
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) {
+ $element = $variables['element'];
+
$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 8 Oct 2009 16:11:55 -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,9 @@ function file_managed_file_save_upload($
/**
* Theme a managed file element.
*/
-function theme_file_managed_file($element) {
+function theme_file_managed_file($variables) {
+ $element = $variables['element'];
+
// This wrapper is required to apply JS behaviors and CSS styling.
$output = '';
$output .= '
';
@@ -589,12 +591,15 @@ function theme_file_managed_file($elemen
/**
* Output a link to a file.
*
- * @param $file
- * A file object to which the link will be created.
+ * @param $variables
+ * An associative array containing:
+ * - file: A file object to which the link will be created.
*/
-function theme_file_link($file) {
+function theme_file_link($variables) {
+ $file = $variables['file'];
+
$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
@@ -619,10 +624,13 @@ function theme_file_link($file) {
/**
* Return an image with an appropriate icon for the given file.
*
- * @param $file
- * A file object for which to make an icon.
+ * @param $variables
+ * An associative array containing:
+ * - file: A file object for which to make an icon.
*/
-function theme_file_icon($file) {
+function theme_file_icon($variables) {
+ $file = $variables['file'];
+
$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 8 Oct 2009 16:11:55 -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.
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 8 Oct 2009 16:11:55 -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,9 @@ function filter_admin_overview_submit($f
*
* @ingroup themeable
*/
-function theme_filter_admin_overview($form) {
+function theme_filter_admin_overview($variables) {
+ $form = $variables['form'];
+
$rows = array();
foreach (element_children($form['formats']) as $id) {
$form['formats'][$id]['weight']['#attributes']['class'] = array('text-format-order-weight');
@@ -75,7 +77,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 +155,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 +344,9 @@ function filter_admin_order($form, &$for
*
* @ingroup themeable
*/
-function theme_filter_admin_order($form) {
+function theme_filter_admin_order($variables) {
+ $form = $variables['form'];
+
$header = array(t('Name'), t('Weight'));
$rows = array();
foreach (element_children($form['names']) as $id) {
@@ -356,7 +360,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.293
diff -u -p -r1.293 filter.module
--- modules/filter/filter.module 5 Oct 2009 01:18:25 -0000 1.293
+++ modules/filter/filter.module 8 Oct 2009 16:11:55 -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 & 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')) . '
'; // End preview-image.
@@ -714,11 +726,15 @@ function theme_image_style_preview($styl
/**
* Theme callback for displaying a grid of checkboxes.
*
- * @param $element
- * A Form API element containing radio buttons.
+ * @param $variables
+ * An associative array containing:
+ * - element: A Form API element containing radio buttons.
+ *
* @ingroup themeable
*/
-function theme_image_anchor($element) {
+function theme_image_anchor($variables) {
+ $element = $variables['element'];
+
$rows = array();
$row = array();
foreach (element_children($element) as $n => $key) {
@@ -731,17 +747,21 @@ 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'))));
}
/**
* Theme callback for image resize effect summary output.
*
- * @param $data
- * The current configuration for this resize effect.
+ * @param $variables
+ * An associative array containing:
+ * - data: The current configuration for this resize effect.
+ *
* @ingroup themeable
*/
-function theme_image_resize_summary($data) {
+function theme_image_resize_summary($variables) {
+ $data = $variables['data'];
+
if ($data['width'] && $data['height']) {
return check_plain($data['width']) . 'x' . check_plain($data['height']);
}
@@ -753,32 +773,40 @@ function theme_image_resize_summary($dat
/**
* Theme callback for image scale effect summary output.
*
- * @param $data
- * The current configuration for this scale effect.
+ * @param $variables
+ * An associative array containing:
+ * - data: 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) {
+ $data = $variables['data'];
+ return theme('image_resize_summary', array('data' => $data)) . ' ' . ($data['upscale'] ? '(' . t('upscaling allowed') . ')' : '');
}
/**
* Theme callback for image crop effect summary output.
*
- * @param $data
- * The current configuration for this crop effect.
+ * @param $variables
+ * An associative array containing:
+ * - 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);
}
/**
* Theme callback for image rotate effect summary output.
*
- * @param $data
- * The current configuration for this rotate effect.
+ * @param $variables
+ * An associative array containing:
+ * - data: The current configuration for this rotate effect.
+ *
* @ingroup themeable
*/
-function theme_image_rotate_summary($data) {
+function theme_image_rotate_summary($variables) {
+ $data = $variables['data'];
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.17
diff -u -p -r1.17 image.module
--- modules/image/image.module 30 Sep 2009 18:36:02 -0000 1.17
+++ modules/image/image.module 8 Oct 2009 16:11:56 -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:') . '
' . 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' => '',
@@ -782,27 +782,27 @@ function image_effect_apply($image, $eff
/**
* Return a themed image using a specific image style.
*
- * @param $style_name
- * The name of the style to be used to alter the original image.
- * @param $path
- * The path of the image file relative to the Drupal files directory.
- * This function does not work with images outside the files directory nor
- * with remotely hosted images.
- * @param $alt
- * The alternative text for text-based browsers.
- * @param $title
- * The title text is displayed when the image is hovered in some popular
- * browsers.
- * @param $attributes
- * Associative array of attributes to be placed in the img tag.
- * @param $getsize
- * If set to TRUE, the image's dimension are fetched and added as
- * width/height attributes.
+ * @param $variables
+ * An associative array containing:
+ * - style_name: The name of the style to be used to alter the original image.
+ * - path: The path of the image file relative to the Drupal files directory.
+ * This function does not work with images outside the files directory nor
+ * with remotely hosted images.
+ * - alt: The alternative text for text-based browsers.
+ * - title: The title text is displayed when the image is hovered in some
+ * popular browsers.
+ * - attributes: Associative array of attributes to be placed in the img tag.
+ * - getsize: If set to TRUE, the image's dimension are fetched and added as
+ * width/height attributes.
+ *
* @return
* 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) {
+ $style_name = $variables['style_name'];
+ $path = $variables['path'];
+
// 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 +810,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 8 Oct 2009 16:11:56 -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,8 +666,10 @@ function locale_block_view($delta = '')
*
* @ingroup themeable
*/
-function theme_locale_translation_filters($form) {
+function theme_locale_translation_filters($variables) {
+ $form = $variables['form'];
$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.61
diff -u -p -r1.61 menu.admin.inc
--- modules/menu/menu.admin.inc 3 Oct 2009 01:16:02 -0000 1.61
+++ modules/menu/menu.admin.inc 8 Oct 2009 16:11:56 -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 .= '
' . t('The following modules will be completely uninstalled from your site, and all data from these modules will be lost!') . '
' . theme('item_list', array('items' => $uninstall)));
$form = confirm_form(
$form,
t('Confirm uninstall'),
@@ -1900,7 +1900,7 @@ function system_status($check = FALSE) {
->condition('pass', '')
->condition('status', 0)
->execute();
- return theme('status_report', $requirements);
+ return theme('status_report', array('requirements' => $requirements));
}
/**
@@ -1953,12 +1953,16 @@ function system_batch_page() {
/**
* This function formats an administrative block for display.
*
- * @param $block
- * An array containing information about the block. It should
- * include a 'title', a 'description' and a formatted 'content'.
+ * @param $variables
+ * An associative array containing:
+ * - block: An array containing information about the block. It should
+ * include a 'title', a 'description' and a formatted 'content'.
+ *
* @ingroup themeable
*/
-function theme_admin_block($block) {
+function theme_admin_block($variables) {
+ $block = $variables['block'];
+
// Don't display the block if it has no content to display.
if (empty($block['show'])) {
return '';
@@ -1994,12 +1998,16 @@ EOT;
/**
* This function formats the content of an administrative block.
*
- * @param $content
- * An array containing information about the block. It should
- * include a 'title', a 'description' and a formatted 'content'.
+ * @param $variables
+ * An associative array containing:
+ * - content: An array containing information about the block. It should
+ * include a 'title', a 'description' and a formatted 'content'.
+ *
* @ingroup themeable
*/
-function theme_admin_block_content($content) {
+function theme_admin_block_content($variables) {
+ $content = $variables['content'];
+
if (!$content) {
return '';
}
@@ -2025,19 +2033,23 @@ function theme_admin_block_content($cont
/**
* This function formats an administrative page for viewing.
*
- * @param $blocks
- * An array of blocks to display. Each array should include a
- * 'title', a 'description', a formatted 'content' and a
- * 'position' which will control which container it will be
- * in. This is usually 'left' or 'right'.
+ * @param $variables
+ * An associative array containing:
+ * - blocks: An array of blocks to display. Each array should include a
+ * 'title', a 'description', a formatted 'content' and a
+ * 'position' which will control which container it will be
+ * in. This is usually 'left' or 'right'.
+ *
* @ingroup themeable
*/
-function theme_admin_page($blocks) {
+function theme_admin_page($variables) {
+ $blocks = $variables['blocks'];
+
$stripe = 0;
$container = array();
foreach ($blocks as $block) {
- if ($block_output = theme('admin_block', $block)) {
+ if ($block_output = theme('admin_block', array('block' => $block))) {
if (empty($block['position'])) {
// perform automatic striping.
$block['position'] = ++$stripe % 2 ? 'left' : 'right';
@@ -2064,11 +2076,15 @@ function theme_admin_page($blocks) {
/**
* Theme output of the dashboard page.
*
- * @param $menu_items
- * An array of modules to be displayed.
+ * @param $variables
+ * An associative array containing:
+ * - menu_items: An array of modules to be displayed.
+ *
* @ingroup themeable
*/
-function theme_system_admin_by_module($menu_items) {
+function theme_system_admin_by_module($variables) {
+ $menu_items = $variables['menu_items'];
+
$stripe = 0;
$output = '';
$container = array('left' => '', 'right' => '');
@@ -2083,11 +2099,11 @@ function theme_system_admin_by_module($m
if (count($items)) {
$block = array();
$block['title'] = $module;
- $block['content'] = theme('item_list', $items);
+ $block['content'] = theme('item_list', array('items' => $items));
$block['description'] = t($description);
$block['show'] = TRUE;
- if ($block_output = theme('admin_block', $block)) {
+ if ($block_output = theme('admin_block', array('block' => $block))) {
if (!isset($block['position'])) {
// Perform automatic striping.
$block['position'] = $position;
@@ -2112,11 +2128,15 @@ function theme_system_admin_by_module($m
/**
* Theme requirements status report.
*
- * @param $requirements
- * An array of requirements.
+ * @param $variables
+ * An associative array containing:
+ * - requirements: An array of requirements.
+ *
* @ingroup themeable
*/
-function theme_status_report($requirements) {
+function theme_status_report($variables) {
+ $requirements = $variables['requirements'];
+
$i = 0;
$output = '
';
foreach ($requirements as $requirement) {
@@ -2149,11 +2169,15 @@ function theme_status_report($requiremen
/**
* Theme callback for the modules form.
*
- * @param $form
- * An associative array containing the structure of the form.
+ * @param $variables
+ * An associative array containing:
+ * - form: An associative array containing the structure of the form.
+ *
* @ingroup themeable
*/
-function theme_system_modules_fieldset($form) {
+function theme_system_modules_fieldset($variables) {
+ $form = $variables['form'];
+
// Individual table headers.
$rows = array();
// Iterate through all the modules, which are
@@ -2188,32 +2212,40 @@ function theme_system_modules_fieldset($
$rows[] = $row;
}
- return theme('table', $form['#header'], $rows);
+ return theme('table', array('header' => $form['#header'], 'rows' => $rows));
}
/**
* Themes an incompatible message.
*
* @ingroup themeable
- * @param $message
- * The form array representing the currently disabled modules.
+ *
+ * @param $variables
+ * An associative array containing:
+ * - message: The form array representing the currently disabled modules.
+ *
* @return
* An HTML string for the message.
*/
-function theme_system_modules_incompatible($message) {
- return '
';
}
/**
* Themes a table of currently disabled modules.
*
* @ingroup themeable
- * @param $form
- * The form array representing the currently disabled modules.
+ *
+ * @param $variables
+ * An associative array containing:
+ * - form: The form array representing the currently disabled modules.
+ *
* @return
* An HTML string representing the table.
*/
-function theme_system_modules_uninstall($form) {
+function theme_system_modules_uninstall($variables) {
+ $form = $variables['form'];
+
// No theming for the confirm form.
if (isset($form['confirm'])) {
return drupal_render($form);
@@ -2240,7 +2272,7 @@ function theme_system_modules_uninstall(
$rows[] = array(array('data' => t('No modules are available to uninstall.'), 'colspan' => '3', 'align' => 'center', 'class' => array('message')));
}
- $output = theme('table', $header, $rows);
+ $output = theme('table', array('header' => $header, 'rows' => $rows));
$output .= drupal_render_children($form);
return $output;
@@ -2249,11 +2281,15 @@ function theme_system_modules_uninstall(
/**
* Theme function for the system themes form.
*
- * @param $form
- * An associative array containing the structure of the form.
+ * @param $variables
+ * An associative array containing:
+ * - form: An associative array containing the structure of the form.
+ *
* @ingroup themeable
*/
-function theme_system_themes_form($form) {
+function theme_system_themes_form($variables) {
+ $form = $variables['form'];
+
foreach (element_children($form) as $key) {
// Only look for themes
if (!isset($form[$key]['info'])) {
@@ -2267,12 +2303,12 @@ function theme_system_themes_form($form)
// Make sure it is compatible and render the checkbox if so.
if (isset($form['status']['#incompatible_themes_core'][$key])) {
unset($form['status'][$key]);
- $status = theme('image', 'misc/watchdog-error.png', t('incompatible'), t('Incompatible with this version of Drupal core'));
+ $status = theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => t('incompatible'), 'title' => t('Incompatible with this version of Drupal core')));
$description .= '
' . t('This version is incompatible with the !core_version version of Drupal core.', array('!core_version' => VERSION)) . '
';
}
elseif (isset($form['status']['#incompatible_themes_php'][$key])) {
unset($form['status'][$key]);
- $status = theme('image', 'misc/watchdog-error.png', t('incompatible'), t('Incompatible with this version of PHP'));
+ $status = theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => t('incompatible'), 'title' => t('Incompatible with this version of PHP')));
$php_required = $form['status']['#incompatible_themes_php'][$key];
if (substr_count($php_required, '.') < 2) {
$php_required .= '.*';
@@ -2300,7 +2336,7 @@ function theme_system_themes_form($form)
}
$header = array(t('Screenshot'), t('Name'), t('Version'), t('Enabled'), t('Default'), t('Operations'));
- $output = theme('table', $header, $rows);
+ $output = theme('table', array('header' => $header, 'rows' => $rows));
$output .= drupal_render_children($form);
return $output;
}
@@ -2348,12 +2384,12 @@ function system_actions_manage() {
}
if ($row) {
- $pager = theme('pager', NULL);
+ $pager = theme('pager', array('tags' => NULL));
if (!empty($pager)) {
$row[] = array(array('data' => $pager, 'colspan' => '3'));
}
$build['system_actions_header'] = array('#markup' => '