summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-10-09 01:00:08 +0000
committerDries Buytaert <dries@buytaert.net>2009-10-09 01:00:08 +0000
commitc05f2181dc8556cb6700e8c6bb6e6ded43273192 (patch)
tree5446facb7f5f18dfaac48aade56c0d86f1477fff /modules
parent48dd14a898420ae98984c951f59e8d299080bee8 (diff)
downloadbrdo-c05f2181dc8556cb6700e8c6bb6e6ded43273192.tar.gz
brdo-c05f2181dc8556cb6700e8c6bb6e6ded43273192.tar.bz2
- Patch #572618 by effulgentsia, pwolanin, sun: all theme functions should take a single argument. Code clean-up and performance improvement. Woot.
Diffstat (limited to 'modules')
-rw-r--r--modules/aggregator/aggregator.admin.inc4
-rw-r--r--modules/aggregator/aggregator.module23
-rw-r--r--modules/aggregator/aggregator.pages.inc70
-rw-r--r--modules/aggregator/aggregator.parser.inc2
-rw-r--r--modules/blog/blog.module2
-rw-r--r--modules/blog/blog.pages.inc2
-rw-r--r--modules/book/book.admin.inc10
-rw-r--r--modules/book/book.module10
-rw-r--r--modules/book/book.pages.inc4
-rw-r--r--modules/color/color.module6
-rw-r--r--modules/comment/comment.admin.inc2
-rw-r--r--modules/comment/comment.module29
-rw-r--r--modules/contact/contact.admin.inc2
-rw-r--r--modules/contact/contact.pages.inc4
-rw-r--r--modules/dblog/dblog.admin.inc14
-rw-r--r--modules/dblog/dblog.module4
-rw-r--r--modules/field/field.api.php54
-rw-r--r--modules/field/field.form.inc5
-rw-r--r--modules/field/modules/list/list.module6
-rw-r--r--modules/field/modules/number/number.module15
-rw-r--r--modules/field/modules/options/options.module22
-rw-r--r--modules/field/modules/text/text.module24
-rw-r--r--modules/field_ui/field_ui.admin.inc4
-rw-r--r--modules/file/file.field.inc46
-rw-r--r--modules/file/file.module28
-rw-r--r--modules/file/tests/file.test2
-rw-r--r--modules/filter/filter.admin.inc18
-rw-r--r--modules/filter/filter.module14
-rw-r--r--modules/filter/filter.pages.inc44
-rw-r--r--modules/forum/forum-icon.tpl.php2
-rw-r--r--modules/forum/forum.module18
-rw-r--r--modules/forum/forum.pages.inc2
-rw-r--r--modules/forum/forums.tpl.php2
-rw-r--r--modules/help/help.admin.inc2
-rw-r--r--modules/image/image.admin.inc96
-rw-r--r--modules/image/image.module41
-rw-r--r--modules/locale/locale.module6
-rw-r--r--modules/menu/menu.admin.inc18
-rw-r--r--modules/node/content_types.inc9
-rw-r--r--modules/node/node.admin.inc18
-rw-r--r--modules/node/node.module26
-rw-r--r--modules/node/node.pages.inc26
-rw-r--r--modules/openid/openid.module2
-rw-r--r--modules/poll/poll.module12
-rw-r--r--modules/poll/poll.pages.inc8
-rw-r--r--modules/profile/profile.admin.inc6
-rw-r--r--modules/profile/profile.module8
-rw-r--r--modules/profile/profile.pages.inc14
-rw-r--r--modules/search/search.api.php2
-rw-r--r--modules/search/search.module2
-rw-r--r--modules/search/search.pages.inc17
-rw-r--r--modules/simpletest/simpletest.module2
-rw-r--r--modules/simpletest/simpletest.pages.inc31
-rw-r--r--modules/simpletest/tests/common_test.module4
-rw-r--r--modules/simpletest/tests/field_test.module8
-rw-r--r--modules/simpletest/tests/theme.test4
-rw-r--r--modules/statistics/statistics.admin.inc6
-rw-r--r--modules/statistics/statistics.pages.inc2
-rw-r--r--modules/syslog/syslog.module5
-rw-r--r--modules/system/page.tpl.php4
-rw-r--r--modules/system/system.admin.inc150
-rw-r--r--modules/system/system.module26
-rw-r--r--modules/taxonomy/taxonomy.admin.inc16
-rw-r--r--modules/taxonomy/taxonomy.module12
-rw-r--r--modules/taxonomy/taxonomy.pages.inc2
-rw-r--r--modules/tracker/tracker.pages.inc4
-rw-r--r--modules/trigger/trigger.admin.inc12
-rw-r--r--modules/trigger/trigger.module2
-rw-r--r--modules/update/update.report.inc53
-rw-r--r--modules/upload/upload.module16
-rw-r--r--modules/user/user.admin.inc28
-rw-r--r--modules/user/user.module36
72 files changed, 718 insertions, 512 deletions
diff --git a/modules/aggregator/aggregator.admin.inc b/modules/aggregator/aggregator.admin.inc
index b1fc85a8d..55c979b8c 100644
--- a/modules/aggregator/aggregator.admin.inc
+++ b/modules/aggregator/aggregator.admin.inc
@@ -32,7 +32,7 @@ function aggregator_view() {
if (empty($rows)) {
$rows[] = array(array('data' => t('No feeds available. <a href="@link">Add feed</a>.', 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. <a href="@link">Add category</a>.', 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;
}
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index 765f877e6..d8428f98d 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -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 '<a href="' . check_url($item->link) . '">' . check_plain($item->title) . "</a>\n";
-
+ return '<a href="' . check_url($variables['item']->link) . '">' . check_plain($variables['item']->title) . "</a>\n";
}
/**
diff --git a/modules/aggregator/aggregator.pages.inc b/modules/aggregator/aggregator.pages.inc
index b34787f93..5690aa798 100644
--- a/modules/aggregator/aggregator.pages.inc
+++ b/modules/aggregator/aggregator.pages.inc
@@ -37,7 +37,7 @@ function aggregator_page_source($arg1, $arg2 = NULL) {
// $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, $op, $feed_source = '') {
// 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($items, $feed_source = '') {
'#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_submit($form, &$form_state) {
/**
* 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_items($form) {
);
}
}
- $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_items($form) {
* @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 = NULL) {
}
$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 = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
@@ -454,7 +466,7 @@ function theme_aggregator_page_opml($feeds) {
*/
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_summary_item(&$variables) {
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)));
diff --git a/modules/aggregator/aggregator.parser.inc b/modules/aggregator/aggregator.parser.inc
index f5a490241..aa616569f 100644
--- a/modules/aggregator/aggregator.parser.inc
+++ b/modules/aggregator/aggregator.parser.inc
@@ -37,7 +37,7 @@ function aggregator_aggregator_parse($feed) {
}
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 = '';
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index f79634f29..600a8d33f 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -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;
}
diff --git a/modules/blog/blog.pages.inc b/modules/blog/blog.pages.inc
index 1d3afd563..6936f54be 100644
--- a/modules/blog/blog.pages.inc
+++ b/modules/blog/blog.pages.inc
@@ -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)));
diff --git a/modules/book/book.admin.inc b/modules/book/book.admin.inc
index d1745473a..b6a7e9b5d 100644
--- a/modules/book/book.admin.inc
+++ b/modules/book/book.admin.inc
@@ -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, &$form) {
* @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')));
}
diff --git a/modules/book/book.module b/modules/book/book.module
index eed90fbaa..3adb48741 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -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 = '', $edit = array()) {
*
* @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_mode) {
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, $children = '') {
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));
}
/**
diff --git a/modules/book/book.pages.inc b/modules/book/book.pages.inc
index 5909c5b58..206f61b79 100644
--- a/modules/book/book.pages.inc
+++ b/modules/book/book.pages.inc
@@ -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();
diff --git a/modules/color/color.module b/modules/color/color.module
index 67d7ba922..72d2037d0 100644
--- a/modules/color/color.module
+++ b/modules/color/color.module
@@ -60,7 +60,7 @@ function _color_theme_select_form_alter(&$form, &$form_state) {
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_state, $theme) {
*
* @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) . '/';
diff --git a/modules/comment/comment.admin.inc b/modules/comment/comment.admin.inc
index 2cd5966e4..07e19c7a3 100644
--- a/modules/comment/comment.admin.inc
+++ b/modules/comment/comment.admin.inc
@@ -87,7 +87,7 @@ function comment_admin_overview($form, &$form_state, $arg) {
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)),
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 8a8e43f94..a5f3a2999 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -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_mode) {
);
}
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_mode) {
}
}
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_state, $comment) {
$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(&$variables) {
$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(&$variables) {
/**
* 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) {
diff --git a/modules/contact/contact.admin.inc b/modules/contact/contact.admin.inc
index 3331b1a1a..c0d2ca298 100644
--- a/modules/contact/contact.admin.inc
+++ b/modules/contact/contact.admin.inc
@@ -33,7 +33,7 @@ function contact_admin_categories() {
$rows[] = array(array('data' => t('No categories available. <a href="@link">Add category</a>.', array('@link' => url('admin/structure/contact/add'))), 'colspan' => 5));
}
- return theme('table', $header, $rows);
+ return theme('table', array('header' => $header, 'rows' => $rows));
}
/**
diff --git a/modules/contact/contact.pages.inc b/modules/contact/contact.pages.inc
index 895fa4e3a..a959146e6 100644
--- a/modules/contact/contact.pages.inc
+++ b/modules/contact/contact.pages.inc
@@ -177,11 +177,11 @@ function contact_personal_form($form, &$form_state, $recipient) {
$form['recipient'] = array('#type' => 'value', '#value' => $recipient);
$form['from'] = array('#type' => 'item',
'#title' => t('From'),
- '#markup' => theme('username', $user) . ' &lt;' . check_plain($user->mail) . '&gt;',
+ '#markup' => theme('username', array('account' => $user)) . ' &lt;' . check_plain($user->mail) . '&gt;',
);
$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'),
diff --git a/modules/dblog/dblog.admin.inc b/modules/dblog/dblog.admin.inc
index 7f0547c56..c7d09a7b4 100644
--- a/modules/dblog/dblog.admin.inc
+++ b/modules/dblog/dblog.admin.inc
@@ -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),
diff --git a/modules/dblog/dblog.module b/modules/dblog/dblog.module
index 3c3ef1cab..7607c34b1 100644
--- a/modules/dblog/dblog.module
+++ b/modules/dblog/dblog.module
@@ -173,8 +173,10 @@ function dblog_form_system_logging_settings_alter(&$form, $form_state) {
*
* @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]);
}
diff --git a/modules/field/field.api.php b/modules/field/field.api.php
index 86c8da924..461789a1b 100644
--- a/modules/field/field.api.php
+++ b/modules/field/field.api.php
@@ -778,21 +778,22 @@ function hook_field_formatter_info_alter(&$info) {
* 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.
- */
-function theme_field_formatter_FORMATTER_SINGLE($element) {
+ * @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($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_SINGLE($element) {
* (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.
- */
-function theme_field_formatter_FORMATTER_MULTIPLE($element) {
+ * @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($variables) {
+ $element = $variables['element'];
+
$items = array();
foreach (element_children($element) as $key) {
$items[$key] = $key .':'. $element[$key]['#item']['value'];
diff --git a/modules/field/field.form.inc b/modules/field/field.form.inc
index dea3f588c..11b065df4 100644
--- a/modules/field/field.form.inc
+++ b/modules/field/field.form.inc
@@ -221,7 +221,8 @@ function field_multiple_value_form($field, $instance, $langcode, $items, &$form,
* 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($element) {
}
$output = '<div class="form-item">';
- $output .= theme('table', $header, $rows, array('id' => $table_id, 'class' => array('field-multiple-table')));
+ $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => $table_id, 'class' => array('field-multiple-table'))));
$output .= $element['#description'] ? '<div class="description">' . $element['#description'] . '</div>' : '';
$output .= '<div class="clearfix">' . drupal_render($add_more_button) . '</div>';
$output .= '</div>';
diff --git a/modules/field/modules/list/list.module b/modules/field/modules/list/list.module
index 119cc9fea..a87c146a5 100644
--- a/modules/field/modules/list/list.module
+++ b/modules/field/modules/list/list.module
@@ -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_default($element) {
/**
* 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'];
}
diff --git a/modules/field/modules/number/number.module b/modules/field/modules/number/number.module
index a7c79ec3c..3d3b0c845 100644
--- a/modules/field/modules/number/number.module
+++ b/modules/field/modules/number/number.module
@@ -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($element, &$form_state) {
* 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'];
}
diff --git a/modules/field/modules/options/options.module b/modules/field/modules/options/options.module
index b9ec74173..53bec62c7 100644
--- a/modules/field/modules/options/options.module
+++ b/modules/field/modules/options/options.module
@@ -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, $instance) {
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, $instance) {
* 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
diff --git a/modules/field/modules/text/text.module b/modules/field/modules/text/text.module
index cc0245dee..4a88b1e3a 100644
--- a/modules/field/modules/text/text.module
+++ b/modules/field/modules/text/text.module
@@ -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_trimmed($element) {
* 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_text_value($form, $edit = FALSE) {
*
* 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'];
}
diff --git a/modules/field_ui/field_ui.admin.inc b/modules/field_ui/field_ui.admin.inc
index 6d2f8d7da..f48e03db5 100644
--- a/modules/field_ui/field_ui.admin.inc
+++ b/modules/field_ui/field_ui.admin.inc
@@ -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($bundle) {
'%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');
}
}
diff --git a/modules/file/file.field.inc b/modules/file/file.field.inc
index 1e6ad8d4b..1687e834e 100644
--- a/modules/file/file.field.inc
+++ b/modules/file/file.field.inc
@@ -523,7 +523,7 @@ function file_field_widget(&$form, &$form_state, $field, $instance, $langcode, $
// 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, &$form_state, $field, $instance, $langcode, $
// 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_multiple($element, &$form_state, $form) {
/**
* 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 .= '<div class="file-widget form-managed-file clearfix">';
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($element) {
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($element) {
/**
* 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($description, $upload_validators) {
/**
* 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));
}
diff --git a/modules/file/file.module b/modules/file/file.module
index b804b1a4f..e62e960e4 100644
--- a/modules/file/file.module
+++ b/modules/file/file.module
@@ -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($element, &$form_state, $form) {
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($element) {
/**
* 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 .= '<div class="form-managed-file">';
@@ -589,12 +591,15 @@ function theme_file_managed_file($element) {
/**
* 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 '<img class="file-icon" alt="" title="' . $mime . '" src="' . $icon_url . '" />';
diff --git a/modules/file/tests/file.test b/modules/file/tests/file.test
index 2044102e0..f37050795 100644
--- a/modules/file/tests/file.test
+++ b/modules/file/tests/file.test
@@ -304,7 +304,7 @@ class FileFieldDisplayTestCase extends FileFieldTestCase {
// 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.
diff --git a/modules/filter/filter.admin.inc b/modules/filter/filter.admin.inc
index 34da3c141..f333749d1 100644
--- a/modules/filter/filter.admin.inc
+++ b/modules/filter/filter.admin.inc
@@ -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($form, &$form_state) {
*
* @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($form) {
);
}
$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, &$form_state, $format) {
// 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 = '<p>' . t('No guidelines available.') . '</p>';
}
@@ -342,7 +344,9 @@ function filter_admin_order($form, &$form_state, $format = NULL) {
*
* @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);
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index b5da0aa66..017ad74ae 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -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, $format, $long = FALSE) {
);
}
}
- $output .= theme('table', $header, $rows);
+ $output .= theme('table', array('header' => $header, 'rows' => $rows));
$output .= '<p>' . t('Most unusual characters can be directly entered without any problems.') . '</p>';
$output .= '<p>' . t('If you do encounter problems, try using HTML character entities. A common example looks like &amp;amp; for an ampersand &amp; character. For a full list of entities see HTML\'s <a href="@html-entities">entities</a> page. Some of the available characters include:', array('@html-entities' => 'http://www.w3.org/TR/html4/sgml/entities.html')) . '</p>';
@@ -391,7 +391,7 @@ function _filter_html_tips($filter, $format, $long = FALSE) {
array('data' => $entity[1], 'class' => array('get'))
);
}
- $output .= theme('table', $header, $rows);
+ $output .= theme('table', array('header' => $header, 'rows' => $rows));
return $output;
}
@@ -761,7 +761,7 @@ function filter_form($selected_format = NULL, $weight = NULL, $parents = array('
foreach ($formats as $format) {
$options[$format->format] = $format->name;
$form['format_guidelines'][$format->format] = array(
- '#markup' => theme('filter_guidelines', $format),
+ '#markup' => theme('filter_guidelines', array('format' => $format)),
);
}
$form['format'] = array(
@@ -906,9 +906,11 @@ function theme_filter_tips_more_info() {
*
* @ingroup themeable
*/
-function theme_filter_guidelines($format) {
+function theme_filter_guidelines($variables) {
+ $format = $variables['format'];
+
$name = isset($format->name) ? '<label>' . $format->name . ':</label>' : '';
- return '<div id="filter-guidelines-' . $format->format . '" class="filter-guidelines-item">' . $name . theme('filter_tips', _filter_tips($format->format, FALSE)) . '</div>';
+ return '<div id="filter-guidelines-' . $format->format . '" class="filter-guidelines-item">' . $name . theme('filter_tips', array('tips' => _filter_tips($format->format, FALSE))) . '</div>';
}
/**
diff --git a/modules/filter/filter.pages.inc b/modules/filter/filter.pages.inc
index c7b7982c0..a82153558 100644
--- a/modules/filter/filter.pages.inc
+++ b/modules/filter/filter.pages.inc
@@ -13,10 +13,10 @@
function filter_tips_long() {
$format = arg(2);
if ($format) {
- $output = theme('filter_tips', _filter_tips($format, TRUE), TRUE);
+ $output = theme('filter_tips', array('tips' => _filter_tips($format, TRUE), 'long' => TRUE));
}
else {
- $output = theme('filter_tips', _filter_tips(-1, TRUE), TRUE);
+ $output = theme('filter_tips', array('tips' => _filter_tips(-1, TRUE), 'long' => TRUE));
}
return $output;
}
@@ -25,30 +25,32 @@ function filter_tips_long() {
/**
* Render HTML for a set of filter tips.
*
- * @param $tips
- * An array containing descriptions and a CSS id in the form of
- * 'module-name/filter-id' (only used when $long is TRUE) for each
- * filter in one or more text formats. Example:
- * @code
- * array(
- * 'Full HTML' => array(
- * 0 => array(
- * 'tip' => 'Web page addresses and e-mail addresses turn into links automatically.',
- * 'id' => 'filter/2',
+ * @param $variables
+ * An associative array containing:
+ * - tips: An array containing descriptions and a CSS id in the form of
+ * 'module-name/filter-id' (only used when $long is TRUE) for each
+ * filter in one or more text formats. Example:
+ * @code
+ * array(
+ * 'Full HTML' => array(
+ * 0 => array(
+ * 'tip' => 'Web page addresses and e-mail addresses turn into links automatically.',
+ * 'id' => 'filter/2',
+ * ),
* ),
- * ),
- * );
- * @endcode
- * @param $long
- * (optional) Whether the passed in filter tips contain extended explanations,
- * i.e. intended to be output on the path 'filter/tips' (TRUE), or are in a
- * short format, i.e. suitable to be displayed below a form element. Defaults
- * to FALSE.
+ * );
+ * @endcode
+ * - long: (optional) Whether the passed in filter tips contain extended
+ * explanations, i.e. intended to be output on the path 'filter/tips'
+ * (TRUE), or are in a short format, i.e. suitable to be displayed below a
+ * form element. Defaults to FALSE.
*
* @see _filter_tips()
* @ingroup themeable
*/
-function theme_filter_tips($tips, $long = FALSE) {
+function theme_filter_tips($variables) {
+ $tips = $variables['tips'];
+ $long = $variables['long'];
$output = '';
$multiple = count($tips) > 1;
diff --git a/modules/forum/forum-icon.tpl.php b/modules/forum/forum-icon.tpl.php
index 7f5d007d7..9e8c653a8 100644
--- a/modules/forum/forum-icon.tpl.php
+++ b/modules/forum/forum-icon.tpl.php
@@ -18,7 +18,7 @@
<a id="new">
<?php endif; ?>
-<?php print theme('image', "misc/forum-$icon.png") ?>
+<?php print theme('image', array('path' => "misc/forum-$icon.png")) ?>
<?php if ($new_posts): ?>
</a>
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 71763191b..1d494b2eb 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -596,7 +596,7 @@ function forum_block_view_pre_render($elements) {
$result = $elements['#query']->execute();
if ($node_title_list = node_title_list($result)) {
$elements['forum_list'] = array('#markup' => $node_title_list);
- $elements['forum_more'] = array('#markup' => theme('more_link', url('forum'), t('Read the latest forum topics.')));
+ $elements['forum_more'] = array('#markup' => theme('more_link', array('url' => url('forum'), 'title' => t('Read the latest forum topics.'))));
}
return $elements;
}
@@ -869,14 +869,14 @@ function template_preprocess_forums(&$variables) {
$variables['links'] = $forum_types;
if (!empty($variables['forums'])) {
- $variables['forums'] = theme('forum_list', $variables['forums'], $variables['parents'], $variables['tid']);
+ $variables['forums'] = theme('forum_list', $variables);
}
else {
$variables['forums'] = '';
}
if ($variables['tid'] && !in_array($variables['tid'], variable_get('forum_containers', array()))) {
- $variables['topics'] = theme('forum_topic_list', $variables['tid'], $variables['topics'], $variables['sortby'], $variables['forum_per_page']);
+ $variables['topics'] = theme('forum_topic_list', $variables);
drupal_add_feed(url('taxonomy/term/' . $variables['tid'] . '/0/feed'), 'RSS - ' . $title);
}
else {
@@ -943,7 +943,7 @@ function template_preprocess_forum_list(&$variables) {
}
$variables['forums'][$id]->old_topics = $forum->num_topics - $variables['forums'][$id]->new_topics;
}
- $variables['forums'][$id]->last_reply = theme('forum_submitted', $forum->last_post);
+ $variables['forums'][$id]->last_reply = theme('forum_submitted', array('topic' => $forum->last_post));
}
// Give meaning to $tid for themers. $tid actually stands for term id.
$variables['forum_id'] = $variables['tid'];
@@ -977,7 +977,7 @@ function template_preprocess_forum_topic_list(&$variables) {
if (!empty($variables['topics'])) {
$row = 0;
foreach ($variables['topics'] as $id => $topic) {
- $variables['topics'][$id]->icon = theme('forum_icon', $topic->new, $topic->comment_count, $topic->comment_mode, $topic->sticky);
+ $variables['topics'][$id]->icon = theme('forum_icon', array('new_posts' => $topic->new, 'num_posts' => $topic->comment_count, 'comment_mode' => $topic->comment_mode, 'sticky' => $topic->sticky));
$variables['topics'][$id]->zebra = $row % 2 == 0 ? 'odd' : 'even';
$row++;
@@ -995,8 +995,8 @@ function template_preprocess_forum_topic_list(&$variables) {
$variables['topics'][$id]->message = '';
}
$topic->uid = $topic->last_comment_uid ? $topic->last_comment_uid : $topic->uid;
- $variables['topics'][$id]->created = theme('forum_submitted', $topic);
- $variables['topics'][$id]->last_reply = theme('forum_submitted', isset($topic->last_reply) ? $topic->last_reply : NULL);
+ $variables['topics'][$id]->created = theme('forum_submitted', array('topic' => $topic));
+ $variables['topics'][$id]->last_reply = theme('forum_submitted', array('topic' => isset($topic->last_reply) ? $topic->last_reply : NULL));
$variables['topics'][$id]->new_text = '';
$variables['topics'][$id]->new_url = '';
@@ -1015,7 +1015,7 @@ function template_preprocess_forum_topic_list(&$variables) {
$variables['topic_id'] = $variables['tid'];
unset($variables['tid']);
- $variables['pager'] = theme('pager', NULL);
+ $variables['pager'] = theme('pager', array('tags' => NULL));
}
/**
@@ -1057,7 +1057,7 @@ function template_preprocess_forum_icon(&$variables) {
* @see theme_forum_submitted()
*/
function template_preprocess_forum_submitted(&$variables) {
- $variables['author'] = isset($variables['topic']->uid) ? theme('username', $variables['topic']) : '';
+ $variables['author'] = isset($variables['topic']->uid) ? theme('username', array('account' => $variables['topic'])) : '';
$variables['time'] = isset($variables['topic']->created) ? format_interval(REQUEST_TIME - $variables['topic']->created) : '';
}
diff --git a/modules/forum/forum.pages.inc b/modules/forum/forum.pages.inc
index d1fa160c8..6b01048da 100644
--- a/modules/forum/forum.pages.inc
+++ b/modules/forum/forum.pages.inc
@@ -20,5 +20,5 @@ function forum_page($tid = 0) {
$topics = forum_get_topics($tid, $sortby, $forum_per_page);
}
- return theme('forums', $forums, $topics, $parents, $tid, $sortby, $forum_per_page);
+ return theme('forums', array('forums' => $forums, 'topics' => $topics, 'parents' => $parents, 'tid' => $tid, 'sortby' => $sortby, 'forums_per_page' => $forum_per_page));
}
diff --git a/modules/forum/forums.tpl.php b/modules/forum/forums.tpl.php
index d9a0506c6..0db6c4d48 100644
--- a/modules/forum/forums.tpl.php
+++ b/modules/forum/forums.tpl.php
@@ -20,7 +20,7 @@
?>
<?php if ($forums_defined): ?>
<div id="forum">
- <?php print theme('links', $links); ?>
+ <?php print theme('links', array('links' => $links)); ?>
<?php print $forums; ?>
<?php print $topics; ?>
</div>
diff --git a/modules/help/help.admin.inc b/modules/help/help.admin.inc
index 3de153de6..cb4411f1c 100644
--- a/modules/help/help.admin.inc
+++ b/modules/help/help.admin.inc
@@ -38,7 +38,7 @@ function help_page($name) {
$admin_tasks = system_get_module_admin_tasks($name);
if (!empty($admin_tasks)) {
ksort($admin_tasks);
- $output .= theme('item_list', $admin_tasks, t('@module administration pages', array('@module' => $module['name'])));
+ $output .= theme('item_list', array('items' => $admin_tasks, 'title' => t('@module administration pages', array('@module' => $module['name']))));
}
}
diff --git a/modules/image/image.admin.inc b/modules/image/image.admin.inc
index 559d954b9..5028279bb 100644
--- a/modules/image/image.admin.inc
+++ b/modules/image/image.admin.inc
@@ -14,7 +14,7 @@ function image_style_list() {
$styles = image_styles();
$page['image_style_list'] = array(
- '#markup' => theme('image_style_list', $styles),
+ '#markup' => theme('image_style_list', array('styles' => $styles)),
'#attached' => array(
'css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array('preprocess' => FALSE)),
),
@@ -64,7 +64,7 @@ function image_style_form($form, &$form_state, $style) {
'#markup' => $effect['label'],
);
$form['effects'][$ieid]['summary'] = array(
- '#markup' => isset($effect['summary theme']) ? theme($effect['summary theme'], $effect['data']) : '',
+ '#markup' => isset($effect['summary theme']) ? theme($effect['summary theme'], array('data' => $effect['data'])) : '',
);
$form['effects'][$ieid]['weight'] = array(
'#type' => 'weight',
@@ -106,7 +106,7 @@ function image_style_form($form, &$form_state, $style) {
$form['preview'] = array(
'#type' => 'item',
'#title' => t('Preview'),
- '#markup' => theme('image_style_preview', $style),
+ '#markup' => theme('image_style_preview', array('style' => $style)),
);
$form['submit'] = array(
'#type' => 'submit',
@@ -555,12 +555,16 @@ function image_rotate_form($data) {
/**
* Display the page containing the list of image styles.
*
- * @param $styles
- * An array of all the image styles returned by image_get_styles().
+ * @param $variables
+ * An associative array containing:
+ * - styles: An array of all the image styles returned by image_get_styles().
+ *
* @see image_get_styles()
* @ingroup themeable
*/
-function theme_image_style_list($styles) {
+function theme_image_style_list($variables) {
+ $styles = $variables['styles'];
+
$header = array(t('Style name'), array('data' => t('Operations'), 'colspan' => 3));
$rows = array();
foreach ($styles as $style) {
@@ -583,17 +587,21 @@ function theme_image_style_list($styles) {
));
}
- return theme('table', $header, $rows);
+ return theme('table', array('header' => $header, 'rows' => $rows));
}
/**
* Theme callback for listing the effects within a specific image style.
*
- * @param $form
- * An associative array containing the structure of the effects group.
+ * @param $variables
+ * An associative array containing:
+ * - form: An associative array containing the structure of the effects group.
+ *
* @ingroup themeable
*/
-function theme_image_style_effects($form) {
+function theme_image_style_effects($variables) {
+ $form = $variables['form'];
+
$rows = array();
foreach (element_children($form) as $key) {
@@ -634,7 +642,7 @@ function theme_image_style_effects($form) {
)));
}
- $output = theme('table', $header, $rows, array('id' => 'image-style-effects'));
+ $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'image-style-effects')));
drupal_add_tabledrag('image-style-effects', 'order', 'sibling', 'image-effect-order-weight');
return $output;
}
@@ -642,11 +650,15 @@ function theme_image_style_effects($form) {
/**
* Theme callback for displaying a preview of an image style.
*
- * @param $style
- * The image style array being previewed.
+ * @param $variables
+ * An associative array containing:
+ * - style: The image style array being previewed.
+ *
* @ingroup themeable
*/
-function theme_image_style_preview($style) {
+function theme_image_style_preview($variables) {
+ $style = $variables['style'];
+
$sample_image = variable_get('image_style_preview_image', drupal_get_path('module', 'image') . '/sample.png');
$sample_width = 160;
$sample_height = 160;
@@ -690,7 +702,7 @@ function theme_image_style_preview($style) {
$output .= '<div class="preview-image-wrapper">';
$output .= t('original') . ' (' . l(t('view actual size'), $original_path) . ')';
$output .= '<div class="preview-image original-image" style="' . $original_attributes['style'] . '">';
- $output .= '<a href="' . url($original_path) . '?' . time() . '">' . theme('image', $original_path . '?' . time(), t('Sample original image'), '', $original_attributes, FALSE) . '</a>';
+ $output .= '<a href="' . url($original_path) . '?' . time() . '">' . theme('image', array('path' => $original_path . '?' . time(), 'alt' => t('Sample original image'), 'title' => '', 'attributes' => $original_attributes, 'getsize' => FALSE)) . '</a>';
$output .= '<div class="height" style="height: ' . $original_height . 'px"><span>' . $original_image['height'] . 'px</span></div>';
$output .= '<div class="width" style="width: ' . $original_width . 'px"><span>' . $original_image['width'] . 'px</span></div>';
$output .= '</div>'; // End preview-image.
@@ -700,7 +712,7 @@ function theme_image_style_preview($style) {
$output .= '<div class="preview-image-wrapper">';
$output .= check_plain($style['name']) . ' (' . l(t('view actual size'), file_create_url($preview_file) . '?' . time()) . ')';
$output .= '<div class="preview-image modified-image" style="' . $preview_attributes['style'] . '">';
- $output .= '<a href="' . file_create_url($preview_file) . '?' . time() . '">' . theme('image', file_create_url($preview_file) . '?' . time(), t('Sample modified image'), '', $preview_attributes, FALSE) . '</a>';
+ $output .= '<a href="' . file_create_url($preview_file) . '?' . time() . '">' . theme('image', array('path' => file_create_url($preview_file) . '?' . time(), 'alt' => t('Sample modified image'), 'title' => '', 'attributes' => $preview_attributes, 'getsize' => FALSE)) . '</a>';
$output .= '<div class="height" style="height: ' . $preview_height . 'px"><span>' . $preview_image['height'] . 'px</span></div>';
$output .= '<div class="width" style="width: ' . $preview_width . 'px"><span>' . $preview_image['width'] . 'px</span></div>';
$output .= '</div>'; // End preview-image.
@@ -714,11 +726,15 @@ function theme_image_style_preview($style) {
/**
* 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($data) {
/**
* 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&deg and @degrees&deg', array('@degrees' => str_replace('-', '', $data['degrees']))) : t('@degrees&deg', array('@degrees' => $data['degrees']));
}
diff --git a/modules/image/image.module b/modules/image/image.module
index 603c336b1..bb2830407 100644
--- a/modules/image/image.module
+++ b/modules/image/image.module
@@ -20,7 +20,7 @@ function image_help($path, $arg) {
$output .= '<h3>' . t('Image styles') . '</h3>';
$output .= '<p>' . t('Image <em>styles</em> 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.') .'</p>';
$output .= '<p>' . 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:') . '</p>';
- $output .= theme('item_list', $naming_approaches);
+ $output .= theme('item_list', array('items' => $naming_approaches));
$output .= '<p>' . t('Both approaches are common and which you choose depends on how you use the image style.') . '</p>';
$output .= '<p>' . t('After creating an image style, <em>effects</em> may be added to the style. Image module comes with some basic effects such as <em>crop</em>, <em>scale</em>, <em>desaturate</em>, and <em>rotate</em>. In addition to the effects included with Image, other modules may provide additional effects. Multiple effects may be combined together, such as using the <em>crop and scale</em> effect and the <em>desaturate</em> 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, $effect) {
/**
* 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, $path, $alt = '', $title = '', $attribut
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);
}
/**
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index c2a58917c..f6968c093 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -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]);
}
diff --git a/modules/menu/menu.admin.inc b/modules/menu/menu.admin.inc
index d9bb754b7..cc9b873d6 100644
--- a/modules/menu/menu.admin.inc
+++ b/modules/menu/menu.admin.inc
@@ -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 .= '<div class="description">' . filter_xss_admin($description) . '</div>';
+function theme_menu_admin_overview($variables) {
+ $output = check_plain($variables['title']);
+ $output .= '<div class="description">' . filter_xss_admin($variables['description']) . '</div>';
return $output;
}
@@ -186,7 +186,9 @@ function menu_overview_form_submit($form, &$form_state) {
*
* @ingroup themeable
*/
-function theme_menu_overview_form($form) {
+function theme_menu_overview_form($variables) {
+ $form = $variables['form'];
+
drupal_add_tabledrag('menu-overview', 'match', 'parent', 'menu-plid', 'menu-plid', 'menu-mlid', TRUE, MENU_MAX_DEPTH - 1);
drupal_add_tabledrag('menu-overview', 'order', 'sibling', 'menu-weight');
@@ -220,7 +222,7 @@ function theme_menu_overview_form($form) {
$element['plid']['#type'] = 'hidden';
$row = array();
- $row[] = theme('indentation', $element['#item']['depth'] - 1) . drupal_render($element['title']);
+ $row[] = theme('indentation', array('size' => $element['#item']['depth'] - 1)) . drupal_render($element['title']);
$row[] = array('data' => drupal_render($element['hidden']), 'class' => array('checkbox'));
$row[] = array('data' => drupal_render($element['expanded']), 'class' => array('checkbox'));
$row[] = drupal_render($element['weight']) . drupal_render($element['plid']) . drupal_render($element['mlid']);
@@ -235,7 +237,7 @@ function theme_menu_overview_form($form) {
if (empty($rows)) {
$rows[] = array(array('data' => $form['#empty_text'], 'colspan' => '7'));
}
- $output .= theme('table', $header, $rows, array('id' => 'menu-overview'));
+ $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'menu-overview')));
$output .= drupal_render_children($form);
return $output;
}
diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc
index ccbd5fe07..4634d62e5 100644
--- a/modules/node/content_types.inc
+++ b/modules/node/content_types.inc
@@ -16,10 +16,10 @@ function node_overview_types() {
$rows = array();
foreach ($names as $key => $name) {
- $type = $types[$key];
+ $type = $types[$key];
if (node_hook($type->type, 'form')) {
$type_url_str = str_replace('_', '-', $type->type);
- $row = array(theme('node_admin_overview', $name, $type));
+ $row = array(theme('node_admin_overview', array('name' => $name, 'type' => $type)));
// Set the edit column.
$row[] = array('data' => l(t('edit'), 'admin/structure/types/manage/' . $type_url_str));
@@ -47,7 +47,10 @@ function node_overview_types() {
return $build;
}
-function theme_node_admin_overview($name, $type) {
+function theme_node_admin_overview($variables) {
+ $name = $variables['name'];
+ $type = $variables['type'];
+
$output = check_plain($name);
$output .= ' <small> (Machine name: ' . check_plain($type->type) . ')</small>';
$output .= '<div class="description">' . filter_xss_admin($type->description) . '</div>';
diff --git a/modules/node/node.admin.inc b/modules/node/node.admin.inc
index 618f0b25c..2fd2a54a5 100644
--- a/modules/node/node.admin.inc
+++ b/modules/node/node.admin.inc
@@ -192,8 +192,10 @@ function node_filter_form() {
*
* @ingroup themeable
*/
-function theme_node_filter_form($form) {
+function theme_node_filter_form($variables) {
+ $form = $variables['form'];
$output = '';
+
$output .= '<div id="node-admin-filter">';
$output .= drupal_render($form['filters']);
$output .= '</div>';
@@ -206,8 +208,10 @@ function theme_node_filter_form($form) {
*
* @ingroup themeable
*/
-function theme_node_filters($form) {
+function theme_node_filters($variables) {
+ $form = $variables['form'];
$output = '';
+
$output .= '<ul class="clearfix">';
if (!empty($form['current'])) {
foreach (element_children($form['current']) as $key) {
@@ -358,7 +362,7 @@ function _node_mass_update_batch_finished($success, $results, $operations) {
else {
drupal_set_message(t('An error occurred and processing did not complete.'), 'error');
$message = format_plural(count($results), '1 item successfully processed:', '@count items successfully processed:');
- $message .= theme('item_list', $results);
+ $message .= theme('item_list', array('items' => $results));
drupal_set_message($message);
}
}
@@ -373,7 +377,7 @@ function node_admin_content($form, $form_state) {
// Show the 'add new content' link.
$form['add_content'] = array(
'#access' => _node_add_access(),
- '#markup' => theme('links', array(array('title' => t('Add new content'), 'href' => 'node/add')), array('class' => array('action-links'))),
+ '#markup' => theme('links', array('links' => array(array('title' => t('Add new content'), 'href' => 'node/add')), 'attributes' => array('class' => array('action-links')))),
);
$form[] = node_filter_form();
$form['#submit'][] = 'node_filter_form_submit';
@@ -443,9 +447,9 @@ function node_admin_nodes() {
foreach ($result as $node) {
$l_options = empty($node->language) ? array() : array('language' => $languages[$node->language]);
$options[$node->nid] = array(
- 'title' => l($node->title, 'node/' . $node->nid, $l_options) . ' ' . theme('mark', node_mark($node->nid, $node->changed)),
+ 'title' => l($node->title, 'node/' . $node->nid, $l_options) . ' ' . theme('mark', array('type' => node_mark($node->nid, $node->changed))),
'type' => check_plain(node_type_get_name($node)),
- 'author' => theme('username', $node),
+ 'author' => theme('username', array('account' => $node)),
'status' => $node->status ? t('published') : t('not published'),
'changed' => format_date($node->changed, 'short'),
);
@@ -460,7 +464,7 @@ function node_admin_nodes() {
'#options' => $options,
'#empty' => t('No content available.'),
);
- $form['pager'] = array('#markup' => theme('pager', NULL));
+ $form['pager'] = array('#markup' => theme('pager', array('tags' => NULL)));
return $form;
}
diff --git a/modules/node/node.module b/modules/node/node.module
index 2933e7599..adec8fc2c 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -270,7 +270,7 @@ function node_title_list($result, $title = NULL) {
$num_rows = TRUE;
}
- return $num_rows ? theme('node_list', $items, $title) : FALSE;
+ return $num_rows ? theme('node_list', array('items' => $items, 'title' => $title)) : FALSE;
}
/**
@@ -278,8 +278,8 @@ function node_title_list($result, $title = NULL) {
*
* @ingroup themeable
*/
-function theme_node_list($items, $title = NULL) {
- return theme('item_list', $items, $title);
+function theme_node_list($variables) {
+ return theme('item_list', $variables);
}
/**
@@ -1162,7 +1162,7 @@ function template_preprocess_node(&$variables) {
$node = $variables['node'];
$variables['date'] = format_date($node->created);
- $variables['name'] = theme('username', $node);
+ $variables['name'] = theme('username', array('account' => $node));
$variables['node_url'] = url('node/' . $node->nid);
$variables['title'] = check_plain($node->title);
$variables['page'] = (bool)menu_get_object();
@@ -1185,7 +1185,7 @@ function template_preprocess_node(&$variables) {
// Display post information only on certain node types.
if (variable_get('node_submitted_' . $node->type, TRUE)) {
$variables['display_submitted'] = TRUE;
- $variables['user_picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', $node) : '';
+ $variables['user_picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', array('account' => $node)) : '';
}
else {
$variables['display_submitted'] = FALSE;
@@ -1220,8 +1220,8 @@ function template_preprocess_node(&$variables) {
*
* @ingroup themeable
*/
-function theme_node_log_message($log) {
- return '<div class="log"><div class="title">' . t('Log') . ':</div>' . $log . '</div>';
+function theme_node_log_message($variables) {
+ return '<div class="log"><div class="title">' . t('Log') . ':</div>' . $variables['log'] . '</div>';
}
/**
@@ -1411,7 +1411,7 @@ function node_search_execute($keys = NULL) {
'link' => url('node/' . $item->sid, array('absolute' => TRUE)),
'type' => check_plain(node_type_get_name($node)),
'title' => $node->title,
- 'user' => theme('username', $node),
+ 'user' => theme('username', array('account' => $node)),
'date' => $node->changed,
'node' => $node,
'extra' => $extra,
@@ -1520,7 +1520,9 @@ function node_user_cancel($edit, $account, $method) {
*
* @ingroup themeable
*/
-function theme_node_search_admin($form) {
+function theme_node_search_admin($variables) {
+ $form = $variables['form'];
+
$output = drupal_render($form['info']);
$header = array(t('Factor'), t('Weight'));
@@ -1531,7 +1533,7 @@ function theme_node_search_admin($form) {
$row[] = drupal_render($form['factors'][$key]);
$rows[] = $row;
}
- $output .= theme('table', $header, $rows);
+ $output .= theme('table', array('header' => $header, 'rows' => $rows));
$output .= drupal_render_children($form);
return $output;
@@ -1819,7 +1821,7 @@ function node_block_info() {
*/
function node_block_view($delta = '') {
$block['subject'] = t('Syndicate');
- $block['content'] = theme('feed_icon', url('rss.xml'), t('Syndicate'));
+ $block['content'] = theme('feed_icon', array('url' => url('rss.xml'), 'title' => t('Syndicate')));
return $block;
}
@@ -1967,7 +1969,7 @@ function node_page_default() {
$default_links[] = l(t('Change the default front page'), 'admin/config/system/site-information');
}
if (!empty($default_links)) {
- $default_message .= theme('item_list', $default_links);
+ $default_message .= theme('item_list', array('items' => $default_links));
}
$build['default_message'] = array(
diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc
index 82b6c9628..bd59747df 100644
--- a/modules/node/node.pages.inc
+++ b/modules/node/node.pages.inc
@@ -24,7 +24,7 @@ function node_add_page() {
$item = array_shift($content);
drupal_goto($item['href']);
}
- return theme('node_add_list', $content);
+ return theme('node_add_list', array('content' => $content));
}
/**
@@ -32,7 +32,8 @@ function node_add_page() {
*
* @ingroup themeable
*/
-function theme_node_add_list($content) {
+function theme_node_add_list($variables) {
+ $content = $variables['content'];
$output = '';
if ($content) {
@@ -318,7 +319,9 @@ function node_form_build_preview($form, &$form_state) {
*
* @ingroup themeable
*/
-function theme_node_form($form) {
+function theme_node_form($variables) {
+ $form = $variables['form'];
+
$output = "\n<div class=\"node-form\">\n";
$output .= " <div class=\"standard\">\n";
@@ -361,7 +364,7 @@ function node_preview($node) {
if (!form_get_errors()) {
$cloned_node = clone $node;
$cloned_node->in_preview = TRUE;
- $output = theme('node_preview', $cloned_node);
+ $output = theme('node_preview', array('node' => $cloned_node));
}
drupal_set_title(t('Preview'), PASS_THROUGH);
@@ -372,12 +375,15 @@ function node_preview($node) {
/**
* Display a node preview for display during node creation and editing.
*
- * @param $node
- * The node object which is being previewed.
+ * @param $variables
+ * An associative array containing:
+ * - node: The node object which is being previewed.
*
* @ingroup themeable
*/
-function theme_node_preview($node) {
+function theme_node_preview($variables) {
+ $node = $variables['node'];
+
$output = '<div class="preview">';
$preview_trimmed_version = FALSE;
@@ -504,13 +510,13 @@ function node_revision_overview($node) {
$operations = array();
if ($revision->current_vid > 0) {
- $row[] = array('data' => t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'short'), "node/$node->nid"), '!username' => theme('username', $revision)))
+ $row[] = array('data' => t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'short'), "node/$node->nid"), '!username' => theme('username', array('account' => $revision))))
. (($revision->log != '') ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : ''),
'class' => array('revision-current'));
- $operations[] = array('data' => theme('placeholder', t('current revision')), 'class' => array('revision-current'), 'colspan' => 2);
+ $operations[] = array('data' => theme('placeholder', array('text' => t('current revision'))), 'class' => array('revision-current'), 'colspan' => 2);
}
else {
- $row[] = t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'short'), "node/$node->nid/revisions/$revision->vid/view"), '!username' => theme('username', $revision)))
+ $row[] = t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'short'), "node/$node->nid/revisions/$revision->vid/view"), '!username' => theme('username', array('account' => $revision))))
. (($revision->log != '') ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : '');
if ($revert_permission) {
$operations[] = l(t('revert'), "node/$node->nid/revisions/$revision->vid/revert");
diff --git a/modules/openid/openid.module b/modules/openid/openid.module
index 40520edd4..697f4db5f 100644
--- a/modules/openid/openid.module
+++ b/modules/openid/openid.module
@@ -107,7 +107,7 @@ function _openid_user_login_form_alter(&$form, &$form_state) {
);
$form['openid_links'] = array(
- '#markup' => theme('item_list', $items),
+ '#markup' => theme('item_list', array('items' => $items)),
'#weight' => 1,
);
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 744a282a2..985ddc118 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -744,11 +744,11 @@ function poll_view_results($node, $build_mode, $block = FALSE) {
foreach ($node->choice as $i => $choice) {
if (!empty($choice['chtext'])) {
$chvotes = isset($choice['chvotes']) ? $choice['chvotes'] : NULL;
- $poll_results .= theme('poll_bar', $choice['chtext'], $chvotes, $total_votes, isset($node->vote) && $node->vote == $i, $block);
+ $poll_results .= theme('poll_bar', array('title' => $choice['chtext'], 'votes' => $chvotes, 'total_votes' => $total_votes, 'vote' => isset($node->vote) && $node->vote == $i, 'block' => $block));
}
}
- return theme('poll_results', $node->title, $poll_results, $total_votes, isset($node->links) ? $node->links : array(), $block, $node->nid, isset($node->vote) ? $node->vote : NULL);
+ return theme('poll_results', array('raw_title' => $node->title, 'results' => $poll_results, 'votes' => $total_votes, 'raw_links' => isset($node->links) ? $node->links : array(), 'block' => $block, 'nid' => $node->nid, 'vote' => isset($node->vote) ? $node->vote : NULL));
}
@@ -757,7 +757,9 @@ function poll_view_results($node, $build_mode, $block = FALSE) {
*
* @ingroup themeable
*/
-function theme_poll_choices($form) {
+function theme_poll_choices($variables) {
+ $form = $variables['form'];
+
drupal_add_tabledrag('poll-choice-table', 'order', 'sibling', 'poll-weight');
$delta = 0;
@@ -793,7 +795,7 @@ function theme_poll_choices($form) {
$rows[] = $row;
}
- $output = theme('table', $headers, $rows, array('id' => 'poll-choice-table'));
+ $output = theme('table', array('header' => $headers, 'rows' => $rows, 'attributes' => array('id' => 'poll-choice-table')));
$output .= drupal_render_children($form);
return $output;
}
@@ -812,7 +814,7 @@ function theme_poll_choices($form) {
* @see theme_poll_results()
*/
function template_preprocess_poll_results(&$variables) {
- $variables['links'] = theme('links', $variables['raw_links']);
+ $variables['links'] = theme('links', array('links' => $variables['raw_links']));
if (isset($variables['vote']) && $variables['vote'] > -1 && user_access('cancel own vote')) {
$variables['cancel_form'] = drupal_render(drupal_get_form('poll_cancel_form', $variables['nid']));
}
diff --git a/modules/poll/poll.pages.inc b/modules/poll/poll.pages.inc
index 1db257620..80cb24479 100644
--- a/modules/poll/poll.pages.inc
+++ b/modules/poll/poll.pages.inc
@@ -42,7 +42,7 @@ function poll_page() {
$output .= '<li>' . l($node->title, "node/$node->nid") . ' - ' . format_plural($node->votes, '1 vote', '@count votes') . ' - ' . ($node->active ? t('open') : t('closed')) . '</li>';
}
$output .= '</ul>';
- $output .= theme("pager", NULL);
+ $output .= theme("pager", array('tags' => NULL));
return $output;
}
@@ -72,14 +72,14 @@ function poll_votes($node) {
$rows = array();
foreach ($queried_votes as $vote) {
$rows[] = array(
- $vote->name ? theme('username', $vote) : check_plain($vote->hostname),
+ $vote->name ? theme('username', array('account' => $vote)) : check_plain($vote->hostname),
check_plain($vote->chtext),
format_date($vote->timestamp),
);
}
$build['poll_votes_table'] = array(
- '#theme' => 'table',
- '#header' => $header,
+ '#theme' => 'table',
+ '#header' => $header,
'#rows' => $rows,
'#prefix' => t('This table lists all the recorded votes for this poll. If anonymous users are allowed to vote, they will be identified by the IP address of the computer they used when they voted.'),
);
diff --git a/modules/profile/profile.admin.inc b/modules/profile/profile.admin.inc
index a9303e6e7..227e10881 100644
--- a/modules/profile/profile.admin.inc
+++ b/modules/profile/profile.admin.inc
@@ -95,7 +95,9 @@ function profile_admin_overview_submit($form, &$form_state) {
* @ingroup themeable
* @see profile_admin_overview()
*/
-function theme_profile_admin_overview($form) {
+function theme_profile_admin_overview($variables) {
+ $form = $variables['form'];
+
drupal_add_css(drupal_get_path('module', 'profile') . '/profile.css');
// Add javascript if there's more than one field.
if (isset($form['submit'])) {
@@ -156,7 +158,7 @@ function theme_profile_admin_overview($form) {
}
$header[] = array('data' => t('Operations'), 'colspan' => 2);
- $output = theme('table', $header, $rows, array('id' => 'profile-fields'));
+ $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'profile-fields')));
$output .= drupal_render_children($form);
return $output;
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index da9b34f0b..2ff780480 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -193,7 +193,7 @@ function profile_block_view($delta = '') {
if (!empty($fields)) {
$profile = _profile_update_user_fields($fields, $account);
- $output .= theme('profile_block', $account, $profile, TRUE);
+ $output .= theme('profile_block', array('account' => $account, 'fields' => $profile));
}
if (isset($use_fields['user_profile']) && $use_fields['user_profile']) {
@@ -525,7 +525,7 @@ function profile_category_access($account, $category) {
*/
function template_preprocess_profile_block(&$variables) {
- $variables['user_picture'] = theme('user_picture', $variables['account']);
+ $variables['user_picture'] = theme('user_picture', array('account' => $variables['account']));
$variables['profile'] = array();
// Supply filtered version of $fields that have values.
foreach ($variables['fields'] as $field) {
@@ -549,8 +549,8 @@ function template_preprocess_profile_block(&$variables) {
*/
function template_preprocess_profile_listing(&$variables) {
- $variables['user_picture'] = theme('user_picture', $variables['account']);
- $variables['name'] = theme('username', $variables['account']);
+ $variables['user_picture'] = theme('user_picture', array('account' => $variables['account']));
+ $variables['name'] = theme('username', array('account' => $variables['account']));
$variables['profile'] = array();
// Supply filtered version of $fields that have values.
foreach ($variables['fields'] as $field) {
diff --git a/modules/profile/profile.pages.inc b/modules/profile/profile.pages.inc
index 300e57cae..8c60c68f7 100644
--- a/modules/profile/profile.pages.inc
+++ b/modules/profile/profile.pages.inc
@@ -71,13 +71,13 @@ function profile_browse() {
$content = '';
foreach ($users as $account) {
$profile = _profile_update_user_fields($fields, $account);
- $content .= theme('profile_listing', $account, $profile);
+ $content .= theme('profile_listing', array('account' => $account, 'fields' => $profile));
}
- $output = theme('profile_wrapper', $content);
- $output .= theme('pager', NULL);
+ $output = theme('profile_wrapper', array('content' => $content));
+ $output .= theme('pager', array('tags' => NULL));
if ($field->type == 'selection' || $field->type == 'list' || $field->type == 'textfield') {
- $title = strtr(check_plain($field->page), array('%value' => theme('placeholder', $value)));
+ $title = strtr(check_plain($field->page), array('%value' => theme('placeholder', array('text' => $value))));
}
else {
$title = check_plain($field->page);
@@ -108,10 +108,10 @@ function profile_browse() {
$content = '';
foreach ($users as $account) {
$profile = _profile_update_user_fields($fields, $account);
- $content .= theme('profile_listing', $account, $profile);
+ $content .= theme('profile_listing', array('account' => $account, 'fields' => $profile));
}
- $output = theme('profile_wrapper', $content);
- $output .= theme('pager', NULL);
+ $output = theme('profile_wrapper', array('content' => $content));
+ $output .= theme('pager', array('tags' => NULL));
drupal_set_title(t('User list'));
return $output;
diff --git a/modules/search/search.api.php b/modules/search/search.api.php
index f7c7f2d7f..0cfb1a1e6 100644
--- a/modules/search/search.api.php
+++ b/modules/search/search.api.php
@@ -192,7 +192,7 @@ function hook_search_execute($keys = NULL) {
'link' => url('node/' . $item->sid, array('absolute' => TRUE)),
'type' => check_plain(node_type_get_name($node)),
'title' => $node->title,
- 'user' => theme('username', $node),
+ 'user' => theme('username', array('account' => $node)),
'date' => $node->changed,
'node' => $node,
'extra' => $extra,
diff --git a/modules/search/search.module b/modules/search/search.module
index 9d15edb5e..4108e5c5c 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -965,7 +965,7 @@ function search_data($keys = NULL, $type = 'node') {
return module_invoke($type, 'search_page', $results);
}
else {
- return theme('search_results', $results, $type);
+ return theme('search_results', array('results' => $results, 'type' => $type));
}
}
}
diff --git a/modules/search/search.pages.inc b/modules/search/search.pages.inc
index cdac3350f..f0035e0c2 100644
--- a/modules/search/search.pages.inc
+++ b/modules/search/search.pages.inc
@@ -49,15 +49,16 @@ function search_view($type = 'node') {
/**
* Theme the listing of search results
*
- * @param $title
- * The subject of the listing.
- * @param $content
- * The content of the listing.
+ * @param $variables
+ * An associative array containing:
+ * - title: The subject of the listing.
+ * - content: The content of the listing.
+ *
* @return
* A string containing the listing output.
*/
-function theme_search_results_listing($title, $content) {
- $output = '<h2 class="title">' . $title . '</h2><div>' . $content . '</div>';
+function theme_search_results_listing($variables) {
+ $output = '<h2 class="title">' . $variables['title'] . '</h2><div>' . $variables['content'] . '</div>';
return $output;
}
@@ -73,9 +74,9 @@ function theme_search_results_listing($title, $content) {
function template_preprocess_search_results(&$variables) {
$variables['search_results'] = '';
foreach ($variables['results'] as $result) {
- $variables['search_results'] .= theme('search_result', $result, $variables['type']);
+ $variables['search_results'] .= theme('search_result', array('result' => $result, 'type' => $variables['type']));
}
- $variables['pager'] = theme('pager', NULL);
+ $variables['pager'] = theme('pager', array('tags' => NULL));
// Provide alternate search results template.
$variables['template_files'][] = 'search-results-' . $variables['type'];
}
diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module
index 234ecb89d..5a6cd411e 100644
--- a/modules/simpletest/simpletest.module
+++ b/modules/simpletest/simpletest.module
@@ -209,7 +209,7 @@ function _simpletest_batch_operation($test_list_init, $test_id, &$context) {
}
$context['message'] = t('Processed test @num of @max - %test.', array('%test' => $info['name'], '@num' => $max - $size, '@max' => $max));
$context['message'] .= '<div class="simpletest-' . ($test_results['#fail'] + $test_results['#exception'] ? 'fail' : 'pass') . '">Overall results: ' . _simpletest_format_summary_line($test_results) . '</div>';
- $context['message'] .= theme('item_list', $items);
+ $context['message'] .= theme('item_list', array('items' => $items));
// Save working values for the next iteration.
$context['sandbox']['tests'] = $test_list;
diff --git a/modules/simpletest/simpletest.pages.inc b/modules/simpletest/simpletest.pages.inc
index cb5ccfefc..5ba188f66 100644
--- a/modules/simpletest/simpletest.pages.inc
+++ b/modules/simpletest/simpletest.pages.inc
@@ -60,10 +60,16 @@ function simpletest_test_form($form) {
/**
* Theme the test list generated by simpletest_test_form() into a table.
*
- * @param $table Form array that represent a table.
- * @return HTML output.
+ * @param $variables
+ * An associative array containing:
+ * - table: Form array that represent a table.
+ *
+ * @return
+ * HTML output.
*/
-function theme_simpletest_test_table($table) {
+function theme_simpletest_test_table($variables) {
+ $table = $variables['table'];
+
drupal_add_css(drupal_get_path('module', 'simpletest') . '/simpletest.css');
drupal_add_js(drupal_get_path('module', 'simpletest') . '/simpletest.js');
@@ -77,8 +83,8 @@ function theme_simpletest_test_table($table) {
// Define the images used to expand/collapse the test groups.
$js = array(
'images' => array(
- theme('image', 'misc/menu-collapsed.png', 'Expand', 'Expand'),
- theme('image', 'misc/menu-expanded.png', 'Collapsed', 'Collapsed'),
+ theme('image', array('path' => 'misc/menu-collapsed.png', 'alt' => 'Expand', 'title' => 'Expand')),
+ theme('image', array('path' => 'misc/menu-expanded.png', 'alt' => 'Collapsed', 'title' => 'Collapsed')),
),
);
@@ -140,7 +146,7 @@ function theme_simpletest_test_table($table) {
$test['#name'] = $test_name;
$row[] = drupal_render($test);
- $row[] = theme('indentation', 1) . '<label for="edit-' . $test_name . '">' . $title . '</label>';
+ $row[] = theme('indentation', array('size' => 1)) . '<label for="edit-' . $test_name . '">' . $title . '</label>';
$row[] = '<div class="description">' . $description . '</div>';
$rows[] = array('data' => $row, 'class' => array($test_class . '-test', ($collapsed ? 'js-hide' : '')));
@@ -156,7 +162,7 @@ function theme_simpletest_test_table($table) {
return '<strong>' . t('No tests to display.') . '</strong>';
}
else {
- return theme('table', $header, $rows, array('id' => 'simpletest-form-table'));
+ return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'simpletest-form-table')));
}
}
@@ -358,7 +364,8 @@ function simpletest_result_form_submit($form, &$form_state) {
*
* @return HTML output.
*/
-function theme_simpletest_result_summary($form) {
+function theme_simpletest_result_summary($variables) {
+ $form = $variables['form'];
return '<div class="simpletest-' . ($form['#ok'] ? 'pass' : 'fail') . '">' . _simpletest_format_summary_line($form) . '</div>';
}
@@ -398,10 +405,10 @@ function simpletest_result_status_image($status) {
if (!isset($map)) {
$map = array(
- 'pass' => theme('image', 'misc/watchdog-ok.png', t('Pass')),
- 'fail' => theme('image', 'misc/watchdog-error.png', t('Fail')),
- 'exception' => theme('image', 'misc/watchdog-warning.png', t('Exception')),
- 'debug' => theme('image', 'misc/watchdog-warning.png', t('Debug')),
+ 'pass' => theme('image', array('path' => 'misc/watchdog-ok.png', 'alt' => t('Pass'))),
+ 'fail' => theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => t('Fail'))),
+ 'exception' => theme('image', array('path' => 'misc/watchdog-warning.png', 'alt' => t('Exception'))),
+ 'debug' => theme('image', array('path' => 'misc/watchdog-warning.png', 'alt' => t('Debug'))),
);
}
if (isset($map[$status])) {
diff --git a/modules/simpletest/tests/common_test.module b/modules/simpletest/tests/common_test.module
index e94f72811..f7abf51b6 100644
--- a/modules/simpletest/tests/common_test.module
+++ b/modules/simpletest/tests/common_test.module
@@ -84,8 +84,8 @@ function common_test_theme() {
/**
* Theme function for testing drupal_render() theming.
*/
-function theme_common_test_foo($foo, $bar) {
- return $foo . $bar;
+function theme_common_test_foo($variables) {
+ return $variables['foo'] . $variables['bar'];
}
/**
diff --git a/modules/simpletest/tests/field_test.module b/modules/simpletest/tests/field_test.module
index 6d463daee..6bd73c250 100644
--- a/modules/simpletest/tests/field_test.module
+++ b/modules/simpletest/tests/field_test.module
@@ -570,7 +570,9 @@ function field_test_theme() {
/**
* Theme function for 'field_test_default' formatter.
*/
-function theme_field_formatter_field_test_default($element) {
+function theme_field_formatter_field_test_default($variables) {
+ $element = $variables['element'];
+
$value = $element['#item']['value'];
$settings = $element['#settings'];
@@ -580,7 +582,9 @@ function theme_field_formatter_field_test_default($element) {
/**
* Theme function for 'field_test_multiple' formatter.
*/
-function theme_field_formatter_field_test_multiple($element) {
+function theme_field_formatter_field_test_multiple($variables) {
+ $element = $variables['element'];
+
$settings = $element['#settings'];
$items = array();
diff --git a/modules/simpletest/tests/theme.test b/modules/simpletest/tests/theme.test
index 29fc445c7..56860bd13 100644
--- a/modules/simpletest/tests/theme.test
+++ b/modules/simpletest/tests/theme.test
@@ -70,7 +70,7 @@ class ThemeTableUnitTest extends DrupalWebTestCase {
function testThemeTableStickyHeaders() {
$header = array('one', 'two', 'three');
$rows = array(array(1,2,3), array(4,5,6), array(7,8,9));
- $this->content = theme('table', $header, $rows);
+ $this->content = theme('table', array('header' => $header, 'rows' => $rows));
$js = drupal_add_js();
$this->assertTrue(isset($js['misc/tableheader.js']), t('tableheader.js was included when $sticky = TRUE.'));
$this->assertRaw('sticky-enabled', t('Table has a class of sticky-enabled when $sticky = TRUE.'));
@@ -86,7 +86,7 @@ class ThemeTableUnitTest extends DrupalWebTestCase {
$attributes = array();
$caption = NULL;
$colgroups = array();
- $this->content = theme('table', $header, $rows, $attributes, $caption, $colgroups, FALSE);
+ $this->content = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => $attributes, 'caption' => $caption, 'colgroups' => $colgroups, 'sticky' => FALSE));
$js = drupal_add_js();
$this->assertFalse(isset($js['misc/tableheader.js']), t('tableheader.js was not included because $sticky = FALSE.'));
$this->assertNoRaw('sticky-enabled', t('Table does not have a class of sticky-enabled because $sticky = FALSE.'));
diff --git a/modules/statistics/statistics.admin.inc b/modules/statistics/statistics.admin.inc
index 70137a7bb..d9367743f 100644
--- a/modules/statistics/statistics.admin.inc
+++ b/modules/statistics/statistics.admin.inc
@@ -31,7 +31,7 @@ function statistics_recent_hits() {
$rows[] = array(
array('data' => format_date($log->timestamp, 'short'), 'class' => array('nowrap')),
_statistics_format_item($log->title, $log->path),
- theme('username', $log),
+ theme('username', array('account' => $log)),
l(t('details'), "admin/reports/access/$log->aid"));
}
@@ -133,7 +133,7 @@ function statistics_top_visitors() {
$destination = drupal_get_destination();
foreach ($result as $account) {
$ban_link = $account->iid ? l(t('unblock IP address'), "admin/config/people/ip-blocking/delete/$account->iid", array('query' => $destination)) : l(t('block IP address'), "admin/config/people/ip-blocking/$account->hostname", array('query' => $destination));
- $rows[] = array($account->hits, ($account->uid ? theme('username', $account) : $account->hostname), format_interval(round($account->total / 1000)), (user_access('block IP addresses') && !$account->uid) ? $ban_link : '');
+ $rows[] = array($account->hits, ($account->uid ? theme('username', array('account' => $account)) : $account->hostname), format_interval(round($account->total / 1000)), (user_access('block IP addresses') && !$account->uid) ? $ban_link : '');
}
if (empty($rows)) {
@@ -225,7 +225,7 @@ function statistics_access_log($aid) {
);
$rows[] = array(
array('data' => t('User'), 'header' => TRUE),
- theme('username', $access)
+ theme('username', array('account' => $access))
);
$rows[] = array(
array('data' => t('Hostname'), 'header' => TRUE),
diff --git a/modules/statistics/statistics.pages.inc b/modules/statistics/statistics.pages.inc
index 5d5e799da..b58f1db53 100644
--- a/modules/statistics/statistics.pages.inc
+++ b/modules/statistics/statistics.pages.inc
@@ -33,7 +33,7 @@ function statistics_node_tracker() {
$rows[] = array(
array('data' => format_date($log->timestamp, 'short'), 'class' => array('nowrap')),
_statistics_link($log->url),
- theme('username', $log),
+ theme('username', array('account' => $log)),
l(t('details'), "admin/reports/access/$log->aid"),
);
}
diff --git a/modules/syslog/syslog.module b/modules/syslog/syslog.module
index 224763b2c..11b991da1 100644
--- a/modules/syslog/syslog.module
+++ b/modules/syslog/syslog.module
@@ -77,7 +77,7 @@ function syslog_watchdog(array $log_entry) {
openlog('drupal', LOG_NDELAY, variable_get('syslog_facility', $default_facility));
}
- syslog($log_entry['severity'], theme('syslog_format', $log_entry));
+ syslog($log_entry['severity'], theme('syslog_format', array('entry' => $log_entry)));
}
function syslog_theme() {
@@ -93,7 +93,8 @@ function syslog_theme() {
*
* @ingroup themeable
*/
-function theme_syslog_format($entry) {
+function theme_syslog_format($variables) {
+ $entry = $variables['entry'];
global $base_url;
$message = $base_url;
diff --git a/modules/system/page.tpl.php b/modules/system/page.tpl.php
index c7c0d5526..2c4c8887e 100644
--- a/modules/system/page.tpl.php
+++ b/modules/system/page.tpl.php
@@ -92,7 +92,7 @@
<?php if ($main_menu): ?>
<div id="navigation"><div class="section">
- <?php print theme('links', $main_menu, array('id' => 'main-menu', 'class' => array('links', 'clearfix')), t('Main menu')); ?>
+ <?php print theme('links', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'clearfix')), 'heading' => t('Main menu'))); ?>
</div></div> <!-- /.section, /#navigation -->
<?php endif; ?>
@@ -129,7 +129,7 @@
</div></div> <!-- /#main, /#main-wrapper -->
<div id="footer"><div class="section">
- <?php print theme('links', $secondary_menu, array('id' => 'secondary-menu', 'class' => array('links', 'clearfix')), t('Secondary menu')); ?>
+ <?php print theme('links', array('links' => $secondary_menu, 'attributes' => array('id' => 'secondary-menu', 'class' => array('links', 'clearfix')), 'heading' => t('Secondary menu'))); ?>
<?php print render($page['footer']); ?>
</div></div> <!-- /.section, /#footer -->
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index b7537b7a8..f2c278f77 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -56,7 +56,7 @@ function system_main_admin_page($arg = NULL) {
}
else {
// Theme items below.
- $block['content'] .= theme('admin_block_content', $content);
+ $block['content'] .= theme('admin_block_content', array('content' => $content));
}
}
// Prepare for sorting as in function _menu_tree_check_access().
@@ -66,7 +66,7 @@ function system_main_admin_page($arg = NULL) {
}
if ($blocks) {
ksort($blocks);
- return theme('admin_page', $blocks);
+ return theme('admin_page', array('blocks' => $blocks));
}
else {
return t('You do not have any administrative items.');
@@ -105,7 +105,7 @@ function system_admin_config_page() {
$function = $item['block_callback'];
$block['content'] .= $function();
}
- $block['content'] .= theme('admin_block_content', system_admin_menu_block($item));
+ $block['content'] .= theme('admin_block_content', array('content' => system_admin_menu_block($item)));
// Prepare for sorting as in function _menu_tree_check_access().
// The weight is offset so it is always positive, with a uniform 5-digits.
$blocks[(50000 + $item['weight']) . ' ' . $item['title'] . ' ' . $item['mlid']] = $block;
@@ -113,7 +113,7 @@ function system_admin_config_page() {
}
if ($blocks) {
ksort($blocks);
- return theme('admin_page', $blocks);
+ return theme('admin_page', array('blocks' => $blocks));
}
else {
return t('You do not have any administrative items.');
@@ -133,7 +133,7 @@ function system_admin_config_page() {
function system_admin_menu_block_page() {
$item = menu_get_item();
if ($content = system_admin_menu_block($item)) {
- $output = theme('admin_block_content', $content);
+ $output = theme('admin_block_content', array('content' => $content));
}
else {
$output = t('You do not have any administrative items.');
@@ -172,7 +172,7 @@ function system_admin_by_module() {
$menu_items[$file->info['name']] = array($file->info['description'], $admin_tasks);
}
}
- return theme('system_admin_by_module', $menu_items);
+ return theme('system_admin_by_module', array('menu_items' => $menu_items));
}
/**
@@ -187,7 +187,7 @@ function system_settings_overview() {
$item = menu_get_item('admin/config');
$content = system_admin_menu_block($item);
- $output = theme('admin_block_content', $content);
+ $output = theme('admin_block_content', array('content' => $content));
return $output;
}
@@ -232,7 +232,7 @@ function system_themes_form() {
break;
}
}
- $screenshot = $screenshot ? theme('image', $screenshot, t('Screenshot for %theme theme', array('%theme' => $theme->info['name'])), '', array('class' => array('screenshot')), FALSE) : t('no screenshot');
+ $screenshot = $screenshot ? theme('image', array('path' => $screenshot, 'alt' => t('Screenshot for %theme theme', array('%theme' => $theme->info['name'])), 'title' => '', 'attributes' => array('class' => array('screenshot')), 'getsize' => FALSE)) : t('no screenshot');
$form[$theme->name]['screenshot'] = array('#markup' => $screenshot);
$form[$theme->name]['info'] = array(
@@ -699,7 +699,7 @@ function system_modules($form, $form_state = array()) {
if ($help_arg && $module->status && in_array($filename, module_implements('help'))) {
if (module_invoke($filename, 'help', "admin/help#$filename", $help_arg)) {
// Module has a help page.
- $extra['help'] = theme('more_help_link', url("admin/help/$filename"));
+ $extra['help'] = theme('more_help_link', array('url' => url("admin/help/$filename")));
}
}
// Mark dependents disabled so the user cannot remove required modules.
@@ -816,9 +816,9 @@ function _system_modules_build_row($info, $extra) {
}
else {
$form['enable'] = array(
- '#markup' => theme('image', 'misc/watchdog-error.png', t('incompatible'), $status_short),
+ '#markup' => theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => t('incompatible'), 'title' => $status_short)),
);
- $form['description']['#markup'] .= theme('system_modules_incompatible', $status_long);
+ $form['description']['#markup'] .= theme('system_modules_incompatible', array('message' => $status_long));
}
// Show a "more help" link for modules that have them.
@@ -854,7 +854,7 @@ function system_modules_confirm_form($modules, $storage) {
);
$items[] = format_plural(count($info['requires']), 'You must enable the @required module to install @module.', 'You must enable the @required modules to install @module.', $t_argument);
}
- $form['text'] = array('#markup' => theme('item_list', $items));
+ $form['text'] = array('#markup' => theme('item_list', array('items' => $items)));
if ($form) {
// Set some default form values
@@ -1113,7 +1113,7 @@ function system_modules_uninstall_confirm_form($storage) {
if (isset($uninstall)) {
$form['#confirmed'] = TRUE;
$form['uninstall']['#tree'] = TRUE;
- $form['modules'] = array('#markup' => '<p>' . t('The following modules will be completely uninstalled from your site, and <em>all data from these modules will be lost</em>!') . '</p>' . theme('item_list', $uninstall));
+ $form['modules'] = array('#markup' => '<p>' . t('The following modules will be completely uninstalled from your site, and <em>all data from these modules will be lost</em>!') . '</p>' . 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($content) {
/**
* 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($menu_items) {
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($menu_items) {
/**
* 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 = '<table class="system-status-report">';
foreach ($requirements as $requirement) {
@@ -2149,11 +2169,15 @@ function theme_status_report($requirements) {
/**
* 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($form) {
$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 '<div class="incompatible">' . $message . '</div>';
+function theme_system_modules_incompatible($variables) {
+ return '<div class="incompatible">' . $variables['message'] . '</div>';
}
/**
* 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($form) {
$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($form) {
/**
* 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 .= '<div class="incompatible">' . t('This version is incompatible with the !core_version version of Drupal core.', array('!core_version' => VERSION)) . '</div>';
}
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' => '<h3>' . t('Actions available to Drupal:') . '</h3>');
- $build['system_actions_table'] = array('#markup' => theme('table', $header, $row));
+ $build['system_actions_table'] = array('#markup' => theme('table', array('header' => $header, 'rows' => $row)));
}
if ($actions_map) {
diff --git a/modules/system/system.module b/modules/system/system.module
index 4464e6c54..c3477faf7 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -1465,10 +1465,10 @@ function system_preprocess_page(&$variables) {
list($version, ) = explode('.', VERSION);
// Emit the META tag in the HTML HEAD section
- theme('meta_generator_html', $version);
+ theme('meta_generator_html', array('version' => $version));
// Emit the HTTP Header too
- theme('meta_generator_header', $version);
+ theme('meta_generator_header', array('version' => $version));
$variables['head'] = drupal_get_html_head();
}
@@ -1592,7 +1592,7 @@ function system_block_configure($delta = '') {
$form['wrapper']['preview'] = array(
'#type' => 'item',
'#title' => 'Preview',
- '#markup' => theme('image', $image_path, t('Powered by Drupal, an open source content management system'), t('Powered by Drupal, an open source content management system'), array('class' => array('powered-by-preview')), FALSE),
+ '#markup' => theme('image', array('path' => $image_path, 'alt' => t('Powered by Drupal, an open source content management system'), 'title' => t('Powered by Drupal, an open source content management system'), 'attributes' => array('class' => array('powered-by-preview')), 'getsize' => FALSE)),
);
return $form;
}
@@ -1625,7 +1625,7 @@ function system_block_view($delta = '') {
case 'powered-by':
$image_path = 'misc/' . variable_get('drupal_badge_color', 'powered-blue') . '-' . variable_get('drupal_badge_size', '80x15') . '.png';
$block['subject'] = NULL;
- $block['content'] = theme('system_powered_by', $image_path);
+ $block['content'] = theme('system_powered_by', array('image_path' => $image_path));
return $block;
case 'help':
$block['subject'] = NULL;
@@ -2691,8 +2691,8 @@ function system_timezone($abbreviation = '', $offset = -1, $is_daylight_saving_t
*
* @ingroup themeable
*/
-function theme_system_powered_by($image_path) {
- $image = theme('image', $image_path, t('Powered by Drupal, an open source content management system'), t('Powered by Drupal, an open source content management system'));
+function theme_system_powered_by($variables) {
+ $image = theme('image', array('path' => $variables['image_path'], 'alt' => t('Powered by Drupal, an open source content management system'), 'title' => t('Powered by Drupal, an open source content management system')));
return l($image, 'http://drupal.org', array('html' => TRUE, 'absolute' => TRUE, 'external' => TRUE));
}
@@ -2719,8 +2719,8 @@ function theme_system_compact_link() {
*
* @ingroup themeable
*/
-function theme_meta_generator_html($version = VERSION) {
- drupal_add_html_head('<meta name="Generator" content="Drupal ' . $version . ' (http://drupal.org)" />');
+function theme_meta_generator_html($variables) {
+ drupal_add_html_head('<meta name="Generator" content="Drupal ' . $variables['version'] . ' (http://drupal.org)" />');
}
/**
@@ -2728,8 +2728,8 @@ function theme_meta_generator_html($version = VERSION) {
*
* @ingroup themeable
*/
-function theme_meta_generator_header($version = VERSION) {
- drupal_add_http_header('X-Generator', 'Drupal ' . $version . ' (http://drupal.org)');
+function theme_meta_generator_header($variables) {
+ drupal_add_http_header('X-Generator', 'Drupal ' . $variables['version'] . ' (http://drupal.org)');
}
/**
@@ -2798,7 +2798,7 @@ function system_page_build(&$page) {
),
),
// Trigger cron run for clients not supporting JavaScript (fall-back).
- '#markup' => theme('system_run_cron_image', 'system/run-cron-image'),
+ '#markup' => theme('system_run_cron_image', array('image_path' => 'system/run-cron-image')),
);
}
@@ -2893,7 +2893,7 @@ function system_run_cron_image_access() {
* @see system_run_cron_image()
* @ingroup themeable
*/
-function theme_system_run_cron_image($image_path) {
- return '<noscript><div id="system-cron-image">' . theme('image', $image_path, '', '', array(), FALSE) . '</div></noscript>';
+function theme_system_run_cron_image($variables) {
+ return '<noscript><div id="system-cron-image">' . theme('image', array('path' => $variables['image_path'], 'getsize' => FALSE)) . '</div></noscript>';
}
diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc
index edd021980..a8e51837e 100644
--- a/modules/taxonomy/taxonomy.admin.inc
+++ b/modules/taxonomy/taxonomy.admin.inc
@@ -56,7 +56,9 @@ function taxonomy_overview_vocabularies_submit($form, &$form_state) {
* @ingroup themeable
* @see taxonomy_overview_vocabularies()
*/
-function theme_taxonomy_overview_vocabularies($form) {
+function theme_taxonomy_overview_vocabularies($variables) {
+ $form = $variables['form'];
+
$rows = array();
foreach (element_children($form) as $key) {
@@ -86,7 +88,7 @@ function theme_taxonomy_overview_vocabularies($form) {
drupal_add_tabledrag('taxonomy', 'order', 'sibling', 'vocabulary-weight');
}
$header[] = array('data' => t('Operations'), 'colspan' => '3');
- return theme('table', $header, $rows, array('id' => 'taxonomy')) . drupal_render_children($form);
+ return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'taxonomy'))) . drupal_render_children($form);
}
/**
@@ -507,7 +509,9 @@ function taxonomy_overview_terms_submit($form, &$form_state) {
* @ingroup themeable
* @see taxonomy_overview_terms()
*/
-function theme_taxonomy_overview_terms($form) {
+function theme_taxonomy_overview_terms($variables) {
+ $form = $variables['form'];
+
$page_increment = $form['#page_increment'];
$page_entries = $form['#page_entries'];
$back_peddle = $form['#back_peddle'];
@@ -529,7 +533,7 @@ function theme_taxonomy_overview_terms($form) {
$term = &$form[$key];
$row = array();
- $row[] = (isset($term['#term']['depth']) && $term['#term']['depth'] > 0 ? theme('indentation', $term['#term']['depth']) : '') . drupal_render($term['view']);
+ $row[] = (isset($term['#term']['depth']) && $term['#term']['depth'] > 0 ? theme('indentation', array('size' => $term['#term']['depth'])) : ''). drupal_render($term['view']);
if ($form['#parent_fields']) {
$term['tid']['#attributes']['class'] = array('term-id');
$term['parent']['#attributes']['class'] = array('term-parent');
@@ -579,9 +583,9 @@ function theme_taxonomy_overview_terms($form) {
}
$header = array(t('Name'), t('Operations'));
- $output = theme('table', $header, $rows, array('id' => 'taxonomy'));
+ $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'taxonomy')));
$output .= drupal_render_children($form);
- $output .= theme('pager', NULL);
+ $output .= theme('pager', array('tags' => NULL));
return $output;
}
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index dd9b4792c..d7650ae9f 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -1002,8 +1002,8 @@ function _taxonomy_term_select($title, $value, $vocabulary_id, $description, $bl
*
* @ingroup themeable
*/
-function theme_taxonomy_term_select($element) {
- return theme('select', $element);
+function theme_taxonomy_term_select($variables) {
+ return theme('select', $variables['element']);
}
/**
@@ -1219,16 +1219,16 @@ function taxonomy_field_formatter_info() {
/**
* Theme function for 'link' term field formatter.
*/
-function theme_field_formatter_taxonomy_term_link($element) {
- $term = $element['#item']['taxonomy_term'];
+function theme_field_formatter_taxonomy_term_link($variables) {
+ $term = $variables['element']['#item']['taxonomy_term'];
return l($term->name, taxonomy_term_path($term));
}
/**
* Theme function for 'plain' term field formatter.
*/
-function theme_field_formatter_taxonomy_term_plain($element) {
- $term = $element['#item']['taxonomy_term'];
+function theme_field_formatter_taxonomy_term_plain($variables) {
+ $term = $variables['element']['#item']['taxonomy_term'];
return $term->name;
}
diff --git a/modules/taxonomy/taxonomy.pages.inc b/modules/taxonomy/taxonomy.pages.inc
index 88c0d829d..35c0d09be 100644
--- a/modules/taxonomy/taxonomy.pages.inc
+++ b/modules/taxonomy/taxonomy.pages.inc
@@ -44,7 +44,7 @@ function taxonomy_term_page($term) {
$nodes = node_load_multiple($nids);
$build += node_build_multiple($nodes);
$build['pager'] = array(
- '#markup' => theme('pager', NULL),
+ '#markup' => theme('pager', array('tags' => NULL)),
'#weight' => 5,
);
}
diff --git a/modules/tracker/tracker.pages.inc b/modules/tracker/tracker.pages.inc
index 1466848e5..060f0f483 100644
--- a/modules/tracker/tracker.pages.inc
+++ b/modules/tracker/tracker.pages.inc
@@ -61,8 +61,8 @@ function tracker_page($account = NULL, $set_title = FALSE) {
$rows[] = array(
check_plain(node_type_get_name($node->type)),
- l($node->title, 'node/' . $node->nid) . ' ' . theme('mark', node_mark($node->nid, $node->changed)),
- theme('username', $node),
+ l($node->title, 'node/' . $node->nid) . ' ' . theme('mark', array('type' => node_mark($node->nid, $node->changed))),
+ theme('username', array('account' => $node)),
array('class' => array('replies'), 'data' => $comments),
t('!time ago', array('!time' => format_interval(REQUEST_TIME - $node->last_activity)))
);
diff --git a/modules/trigger/trigger.admin.inc b/modules/trigger/trigger.admin.inc
index 9db7a928f..e3350f80c 100644
--- a/modules/trigger/trigger.admin.inc
+++ b/modules/trigger/trigger.admin.inc
@@ -255,14 +255,18 @@ function trigger_assign_form_submit($form, $form_state) {
/**
* Displays actions assigned to this hook in a table.
*
- * @param array $element
- * The fieldset including all assigned actions.
+ * @param $variables
+ * An associative array containing:
+ * - element: The fieldset including all assigned actions.
+ *
* @return
* The rendered form with the table prepended.
*
* @ingroup themeable
*/
-function theme_trigger_display($element) {
+function theme_trigger_display($variables) {
+ $element = $variables['element'];
+
$header = array();
$rows = array();
if (isset($element['assigned']) && count($element['assigned']['#value'])) {
@@ -277,7 +281,7 @@ function theme_trigger_display($element) {
}
if (count($rows)) {
- $output = theme('table', $header, $rows) . drupal_render_children($element);
+ $output = theme('table', array('header' => $header, 'rows' => $rows)) . drupal_render_children($element);
}
else {
$output = drupal_render_children($element);
diff --git a/modules/trigger/trigger.module b/modules/trigger/trigger.module
index d889007e4..7c831ebe4 100644
--- a/modules/trigger/trigger.module
+++ b/modules/trigger/trigger.module
@@ -180,7 +180,7 @@ function trigger_get_assigned_actions($hook) {
function trigger_theme() {
return array(
'trigger_display' => array(
- 'arguments' => array('element'),
+ 'arguments' => array('element' => NULL),
'file' => 'trigger.admin.inc',
),
);
diff --git a/modules/update/update.report.inc b/modules/update/update.report.inc
index 4d9b8f785..8cc3a6d1c 100644
--- a/modules/update/update.report.inc
+++ b/modules/update/update.report.inc
@@ -13,10 +13,10 @@ function update_status() {
if ($available = update_get_available(TRUE)) {
module_load_include('inc', 'update', 'update.compare');
$data = update_calculate_project_data($available);
- return theme('update_report', $data);
+ return theme('update_report', array('data' => $data));
}
else {
- return theme('update_report', _update_no_data());
+ return theme('update_report', array('data' => _update_no_data()));
}
}
@@ -25,7 +25,9 @@ function update_status() {
*
* @ingroup themeable
*/
-function theme_update_report($data) {
+function theme_update_report($variables) {
+ $data = $variables['data'];
+
$last = variable_get('update_last_check', 0);
$output = '<div class="update checked">' . ($last ? t('Last checked: @timestamp (@time ago)', array('@time' => format_interval(REQUEST_TIME - $last), '@timestamp' => format_date($last))) : t('Last checked: never'));
$output .= ' <span class="check-manually">(' . l(t('Check manually'), 'admin/reports/updates/check') . ')</span>';
@@ -54,29 +56,29 @@ function theme_update_report($data) {
switch ($project['status']) {
case UPDATE_CURRENT:
$class = 'ok';
- $icon = theme('image', 'misc/watchdog-ok.png', t('ok'), t('ok'));
+ $icon = theme('image', array('path' => 'misc/watchdog-ok.png', 'alt' => t('ok'), 'title' => t('ok')));
break;
case UPDATE_UNKNOWN:
case UPDATE_NOT_FETCHED:
$class = 'unknown';
- $icon = theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning'));
+ $icon = theme('image', array('path' => 'misc/watchdog-warning.png', 'alt' => t('warning'), 'title' => t('warning')));
break;
case UPDATE_NOT_SECURE:
case UPDATE_REVOKED:
case UPDATE_NOT_SUPPORTED:
$class = 'error';
- $icon = theme('image', 'misc/watchdog-error.png', t('error'), t('error'));
+ $icon = theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => t('error'), 'title' => t('error')));
break;
case UPDATE_NOT_CHECKED:
case UPDATE_NOT_CURRENT:
default:
$class = 'warning';
- $icon = theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning'));
+ $icon = theme('image', array('path' => 'misc/watchdog-warning.png', 'alt' => t('warning'), 'title' => t('warning')));
break;
}
$row = '<div class="version-status">';
- $status_label = theme('update_status_label', $project['status']);
+ $status_label = theme('update_status_label', array('status' => $project['status']));
$row .= !empty($status_label) ? $status_label : check_plain($project['reason']);
$row .= '<span class="icon">' . $icon . '</span>';
$row .= "</div>\n";
@@ -127,31 +129,31 @@ function theme_update_report($data) {
) {
$version_class[] = 'version-recommended-strong';
}
- $row .= theme('update_version', $project['releases'][$project['recommended']], t('Recommended version:'), $version_class);
+ $row .= theme('update_version', array('version' => $project['releases'][$project['recommended']], 'tag' => t('Recommended version:'), 'class' => $version_class));
}
// Now, print any security updates.
if (!empty($project['security updates'])) {
foreach ($project['security updates'] as $security_update) {
- $row .= theme('update_version', $security_update, t('Security update:'), 'version-security' . $security_class);
+ $row .= theme('update_version', array('version' => $security_update, 'tag' => t('Security update:'), 'class' => 'version-security' . $security_class));
}
}
}
if ($project['recommended'] !== $project['latest_version']) {
- $row .= theme('update_version', $project['releases'][$project['latest_version']], t('Latest version:'), array('version-latest'));
+ $row .= theme('update_version', array('version' => $project['releases'][$project['latest_version']], 'tag' => t('Latest version:'), 'class' => array('version-latest')));
}
if ($project['install_type'] == 'dev'
&& $project['status'] != UPDATE_CURRENT
&& isset($project['dev_version'])
&& $project['recommended'] !== $project['dev_version']) {
- $row .= theme('update_version', $project['releases'][$project['dev_version']], t('Development version:'), array('version-latest'));
+ $row .= theme('update_version', array('version' => $project['releases'][$project['dev_version']], 'tag' => t('Development version:'), 'class' => array('version-latest')));
}
}
if (isset($project['also'])) {
foreach ($project['also'] as $also) {
- $row .= theme('update_version', $project['releases'][$also], t('Also available:'), array('version-also-available'));
+ $row .= theme('update_version', array('version' => $project['releases'][$also], 'tag' => t('Also available:'), 'class' => array('version-also-available')));
}
}
@@ -163,7 +165,7 @@ function theme_update_report($data) {
foreach ($project['extra'] as $key => $value) {
$row .= '<div class="' . implode(' ', $value['class']) . '">';
$row .= check_plain($value['label']) . ': ';
- $row .= theme('placeholder', $value['data']);
+ $row .= theme('placeholder', array('text' => $value['data']));
$row .= "</div>\n";
}
$row .= "</div>\n"; // extra div.
@@ -178,7 +180,7 @@ function theme_update_report($data) {
$row .= t('Includes:');
$includes_items[] = t('Enabled: %includes', array('%includes' => implode(', ', $project['includes'])));
$includes_items[] = t('Disabled: %disabled', array('%disabled' => implode(', ', $project['disabled'])));
- $row .= theme('item_list', $includes_items);
+ $row .= theme('item_list', array('items' => $includes_items));
}
else {
$row .= t('Includes: %includes', array('%includes' => implode(', ', $project['includes'])));
@@ -194,7 +196,7 @@ function theme_update_report($data) {
case UPDATE_NOT_SECURE:
case UPDATE_REVOKED:
case UPDATE_NOT_SUPPORTED:
- $base_themes[] = t('%base_theme (!base_label)', array('%base_theme' => $base_theme, '!base_label' => theme('update_status_label', $status[$base_key])));
+ $base_themes[] = t('%base_theme (!base_label)', array('%base_theme' => $base_theme, '!base_label' => theme('update_status_label', array('status' => $status[$base_key]))));
break;
default:
@@ -235,7 +237,7 @@ function theme_update_report($data) {
if (!empty($rows[$type_name])) {
ksort($rows[$type_name]);
$output .= "\n<h3>" . $type_label . "</h3>\n";
- $output .= theme('table', $header, $rows[$type_name], array('class' => array('update')));
+ $output .= theme('table', array('header' => $header, 'rows' => $rows[$type_name], 'attributes' => array('class' => array('update'))));
}
}
drupal_add_css(drupal_get_path('module', 'update') . '/update.css');
@@ -245,13 +247,14 @@ function theme_update_report($data) {
/**
* Generate the HTML for the label to display for a project's update status.
*
- * @param $status
- * The integer code for a project's current update status.
+ * @param $variables
+ * An associative array containing:
+ * - status: The integer code for a project's current update status.
*
* @see update_calculate_project_data()
*/
-function theme_update_status_label($status) {
- switch ($status) {
+function theme_update_status_label($variables) {
+ switch ($variables['status']) {
case UPDATE_NOT_SECURE:
return '<span class="security-error">' . t('Security update required!') . '</span>';
@@ -275,7 +278,11 @@ function theme_update_status_label($status) {
*
* @ingroup themeable
*/
-function theme_update_version($version, $tag, $class) {
+function theme_update_version($variables) {
+ $version = $variables['version'];
+ $tag = $variables['tag'];
+ $class = $variables['class'];
+
$output = '';
$output .= '<table class="version ' . $class . '">';
$output .= '<tr>';
@@ -294,7 +301,7 @@ function theme_update_version($version, $tag, $class) {
'title' => t('Release notes'),
'href' => $version['release_link'],
);
- $output .= theme('links', $links);
+ $output .= theme('links', array('links' => $links));
$output .= '</td>';
$output .= '</tr>';
$output .= "</table>\n";
diff --git a/modules/upload/upload.module b/modules/upload/upload.module
index d00e7e227..3edcdbed0 100644
--- a/modules/upload/upload.module
+++ b/modules/upload/upload.module
@@ -436,7 +436,9 @@ function upload_node_search_result($node) {
*
* @ingroup themeable
*/
-function theme_upload_attachments($elements) {
+function theme_upload_attachments($variables) {
+ $elements = $variables['elements'];
+
$header = array(t('Attachment'), t('Size'));
$rows = array();
foreach ($elements['#files'] as $file) {
@@ -448,7 +450,7 @@ function theme_upload_attachments($elements) {
}
}
if (count($rows)) {
- return theme('table', $header, $rows, array('class' => array('attachments')));
+ return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('class' => array('attachments'))));
}
}
@@ -600,7 +602,9 @@ function _upload_form($node) {
*
* @ingroup themeable
*/
-function theme_upload_form_current($form) {
+function theme_upload_form_current($variables) {
+ $form = $variables['form'];
+
$header = array('', t('Delete'), t('List'), t('Description'), t('Weight'), t('Size'));
drupal_add_tabledrag('upload-attachments', 'order', 'sibling', 'upload-weight');
@@ -616,7 +620,7 @@ function theme_upload_form_current($form) {
$row[] = drupal_render($form[$key]['size']);
$rows[] = array('data' => $row, 'class' => array('draggable'));
}
- $output = theme('table', $header, $rows, array('id' => 'upload-attachments'));
+ $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'upload-attachments')));
$output .= drupal_render_children($form);
return $output;
}
@@ -627,9 +631,9 @@ function theme_upload_form_current($form) {
*
* @ingroup themeable
*/
-function theme_upload_form_new($form) {
+function theme_upload_form_new($variables) {
drupal_add_tabledrag('upload-attachments', 'order', 'sibling', 'upload-weight');
- $output = drupal_render_children($form);
+ $output = drupal_render_children($variables['form']);
return $output;
}
diff --git a/modules/user/user.admin.inc b/modules/user/user.admin.inc
index d8ae9b699..5bc88acef 100644
--- a/modules/user/user.admin.inc
+++ b/modules/user/user.admin.inc
@@ -187,9 +187,9 @@ function user_admin_account() {
asort($users_roles);
$options[$account->uid] = array(
- 'username' => theme('username', $account),
+ 'username' => theme('username', array('account' => $account)),
'status' => $status[$account->status],
- 'roles' => theme('item_list', $users_roles),
+ 'roles' => theme('item_list', array('items' => $users_roles)),
'member_for' => format_interval(REQUEST_TIME - $account->created),
'access' => $account->access ? t('@time ago', array('@time' => format_interval(REQUEST_TIME - $account->access))) : t('never'),
'operations' => l(t('edit'), "user/$account->uid/edit", array('query' => $destination)),
@@ -202,7 +202,7 @@ function user_admin_account() {
'#options' => $options,
'#empty' => t('No people available.'),
);
- $form['pager'] = array('#markup' => theme('pager', NULL));
+ $form['pager'] = array('#markup' => theme('pager', array('tags' => NULL)));
return $form;
}
@@ -682,7 +682,9 @@ function user_admin_permissions_submit($form, &$form_state) {
*
* @ingroup themeable
*/
-function theme_user_admin_permissions($form) {
+function theme_user_admin_permissions($variables) {
+ $form = $variables['form'];
+
$roles = user_roles();
foreach (element_children($form['permission']) as $key) {
$row = array();
@@ -707,7 +709,7 @@ function theme_user_admin_permissions($form) {
$header[] = array('data' => drupal_render($form['role_names'][$rid]), 'class' => array('checkbox'));
}
$output = theme('system_compact_link');
- $output .= theme('table', $header, $rows, array('id' => 'permissions'));
+ $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'permissions')));
$output .= drupal_render_children($form);
return $output;
}
@@ -770,7 +772,7 @@ function user_admin_role_validate($form, &$form_state) {
if ($form_state['values']['name']) {
if ($form_state['values']['op'] == t('Save role')) {
$role = user_role_load($form_state['values']['name']);
- if ($role && $role->rid != $form_state['values']['rid']) {
+ if ($role && $role->rid != $form_state['values']['rid']) {
form_set_error('name', t('The role name %name already exists. Please choose another role name.', array('%name' => $form_state['values']['name'])));
}
}
@@ -808,7 +810,9 @@ function user_admin_role_submit($form, &$form_state) {
*
* @ingroup themeable
*/
-function theme_user_admin_new_role($form) {
+function theme_user_admin_new_role($variables) {
+ $form = $variables['form'];
+
$header = array(t('Name'), array('data' => t('Operations'), 'colspan' => 2));
foreach (user_roles() as $rid => $name) {
$edit_permissions = l(t('edit permissions'), 'admin/config/people/permissions/' . $rid);
@@ -822,7 +826,7 @@ function theme_user_admin_new_role($form) {
$rows[] = array(drupal_render($form['name']), array('data' => drupal_render($form['submit']), 'colspan' => 2));
$output = drupal_render_children($form);
- $output .= theme('table', $header, $rows);
+ $output .= theme('table', array('header' => $header, 'rows' => $rows));
return $output;
}
@@ -832,7 +836,9 @@ function theme_user_admin_new_role($form) {
*
* @ingroup themeable
*/
-function theme_user_filter_form($form) {
+function theme_user_filter_form($variables) {
+ $form = $variables['form'];
+
$output = '<div id="user-admin-filter">';
$output .= drupal_render($form['filters']);
$output .= '</div>';
@@ -845,7 +851,9 @@ function theme_user_filter_form($form) {
*
* @ingroup themeable
*/
-function theme_user_filters($form) {
+function theme_user_filters($variables) {
+ $form = $variables['form'];
+
$output = '<ul class="clearfix">';
if (!empty($form['current'])) {
foreach (element_children($form['current']) as $key) {
diff --git a/modules/user/user.module b/modules/user/user.module
index 2c8330455..9c8e72869 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -836,7 +836,7 @@ function user_element_info() {
*/
function user_user_view($account) {
$account->content['user_picture'] = array(
- '#markup' => theme('user_picture', $account),
+ '#markup' => theme('user_picture', array('account' => $account)),
'#weight' => -10,
);
if (!isset($account->content['summary'])) {
@@ -954,7 +954,7 @@ function user_login_block($form) {
$items[] = l(t('Create new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
}
$items[] = l(t('Request new password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
- $form['links'] = array('#markup' => theme('item_list', $items));
+ $form['links'] = array('#markup' => theme('item_list', array('items' => $items)));
return $form;
}
@@ -1041,7 +1041,7 @@ function user_block_view($delta = '') {
if (user_access('access content')) {
// Retrieve a list of new users who have subsequently accessed the site successfully.
$items = db_query_range('SELECT uid, name FROM {users} WHERE status <> 0 AND access <> 0 ORDER BY created DESC', 0, variable_get('user_block_whois_new_count', 5))->fetchAll();
- $output = theme('user_list', $items);
+ $output = theme('user_list', array('users' => $items));
$block['subject'] = t('Who\'s new');
$block['content'] = $output;
@@ -1077,7 +1077,7 @@ function user_block_view($delta = '') {
$max_users = variable_get('user_block_max_list_count', 10);
if ($authenticated_count && $max_users) {
$items = db_query_range('SELECT u.uid, u.name, MAX(s.timestamp) AS max_timestamp FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.timestamp >= :interval AND s.uid > 0 GROUP BY u.uid, u.name ORDER BY max_timestamp DESC', 0, $max_users, array(':interval' => $interval))->fetchAll();
- $output .= theme('user_list', $items, t('Online users'));
+ $output .= theme('user_list', array('users' => $items, 'titles' => t('Online users')));
}
$block['subject'] = t('Who\'s online');
@@ -1121,10 +1121,10 @@ function template_preprocess_user_picture(&$variables) {
if (isset($filepath)) {
$alt = t("@user's picture", array('@user' => $account->name ? $account->name : variable_get('anonymous', t('Anonymous'))));
if (module_exists('image') && $style = variable_get('user_picture_style', '')) {
- $variables['user_picture'] = theme('image_style', $style, $filepath, $alt, $alt, array(), FALSE);
+ $variables['user_picture'] = theme('image_style', array('style_name' => $style, 'path' => $filepath, 'alt' => $alt, 'title' => $alt, 'attributes' => array(), 'getsize' => FALSE));
}
else {
- $variables['user_picture'] = theme('image', $filepath, $alt, $alt, array(), FALSE);
+ $variables['user_picture'] = theme('image', array('path' => $filepath, 'alt' => $alt, 'title' => $alt, 'attributes' => array(), 'getsize' => FALSE));
}
if (!empty($account->uid) && user_access('access user profiles')) {
$attributes = array('attributes' => array('title' => t('View user profile.')), 'html' => TRUE);
@@ -1137,20 +1137,24 @@ function template_preprocess_user_picture(&$variables) {
/**
* Make a list of users.
*
- * @param $users
- * An array with user objects. Should contain at least the name and uid.
- * @param $title
- * (optional) Title to pass on to theme_item_list().
+ * @param $variables
+ * An associative array containing:
+ * - users: An array with user objects. Should contain at least the name and
+ * uid.
+ * - title: (optional) Title to pass on to theme_item_list().
*
* @ingroup themeable
*/
-function theme_user_list($users, $title = NULL) {
+function theme_user_list($variables) {
+ $users = $variables['users'];
+ $title = $variables['title'];
+
if (!empty($users)) {
foreach ($users as $user) {
- $items[] = theme('username', $user);
+ $items[] = theme('username', array('account' => $user));
}
}
- return theme('item_list', $items, $title);
+ return theme('item_list', array('items' => $items, 'title' => $title));
}
function user_is_anonymous() {
@@ -1907,7 +1911,7 @@ function user_edit_form(&$form, &$form_state) {
'#value' => isset($account->picture) ? $account->picture : NULL,
);
$form['picture']['picture_current'] = array(
- '#markup' => theme('user_picture', $account),
+ '#markup' => theme('user_picture', array('account' => $account)),
);
$form['picture']['picture_delete'] = array(
'#type' => 'checkbox',
@@ -2834,8 +2838,10 @@ function user_comment_view($comment) {
*
* @ingroup themeable
*/
-function theme_user_signature($signature) {
+function theme_user_signature($variables) {
+ $signature = $variables['signature'];
$output = '';
+
if ($signature) {
$output .= '<div class="clear">';
$output .= '<div>—</div>';