diff --git a/core/authorize.php b/core/authorize.php index fe39394..5797188 100644 --- a/core/authorize.php +++ b/core/authorize.php @@ -118,7 +118,11 @@ function authorize_access_allowed() { drupal_set_message($results['page_message']['message'], $results['page_message']['type']); } - $output = theme('authorize_report', array('messages' => $results['messages'])); + $authorize_report = array( + '#theme' => 'authorize_report', + '#messages' => $results['messages'], + ); + $output = drupal_render($authorize_report); $links = array(); if (is_array($results['tasks'])) { @@ -131,7 +135,12 @@ function authorize_access_allowed() { )); } - $output .= theme('item_list', array('items' => $links, 'title' => t('Next steps'))); + $item_list = array( + '#theme' => 'item_list', + '#items' => $links, + '#title' => t('Next steps'), + ); + $output .= drupal_render($item_list); } // If a batch is running, let it run. elseif (isset($_GET['batch'])) { @@ -156,5 +165,10 @@ function authorize_access_allowed() { if (!empty($output)) { drupal_add_http_header('Content-Type', 'text/html; charset=utf-8'); - print theme('maintenance_page', array('content' => $output, 'show_messages' => $show_messages)); + $maintenance_page = array( + '#theme' => 'maintenance_page', + '#content' => $output, + '#show_messages' => $show_messages, + ); + print drupal_render($maintenance_page); } diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc index 1bced44..4193e31 100644 --- a/core/includes/ajax.inc +++ b/core/includes/ajax.inc @@ -398,7 +398,8 @@ function ajax_prepare_response($page_callback_result) { $commands[] = ajax_command_insert(NULL, $html); // Add the status messages inside the new content's wrapper element, so that // on subsequent Ajax requests, it is treated as old content. - $commands[] = ajax_command_prepend(NULL, theme('status_messages')); + $status_messages = array('#theme' => 'status_messages'); + $commands[] = ajax_command_prepend(NULL, drupal_render($status_messages)); } return $commands; diff --git a/core/includes/batch.inc b/core/includes/batch.inc index 569ce58..b70d2d5 100644 --- a/core/includes/batch.inc +++ b/core/includes/batch.inc @@ -119,7 +119,12 @@ function _batch_progress_page() { // the error message. ob_start(); $fallback = $current_set['error_message'] . '
' . $batch['error_message']; - $fallback = theme('maintenance_page', array('content' => $fallback, 'show_messages' => FALSE)); + $maintenance_page = array( + '#theme' => 'maintenance_page', + '#content' => $fallback, + '#show_messages' => FALSE, + ); + $fallback = drupal_render($maintenance_page); // We strip the end of the page using a marker in the template, so any // additional HTML output by PHP shows up inside the page rather than below @@ -167,7 +172,13 @@ function _batch_progress_page() { drupal_add_js($js_setting, 'setting'); drupal_add_library('system', 'drupal.batch'); - return theme('progress_bar', array('percent' => $percentage, 'message' => $message, 'label' => $label)); + $progress_bar = array( + '#theme' => 'progress_bar', + '#percent' => $percentage, + '#message' => $message, + '#label' => $label, + ); + return drupal_render($progress_bar); } /** diff --git a/core/includes/common.inc b/core/includes/common.inc index 842136e..8f88985 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -391,7 +391,12 @@ function drupal_add_feed($url = NULL, $title = '') { $stored_feed_links = &drupal_static(__FUNCTION__, array()); if (isset($url)) { - $stored_feed_links[$url] = theme('feed_icon', array('url' => $url, 'title' => $title)); + $feed_icon = array( + '#theme' => 'feed_icon', + '#url' => $url, + '#title' => $title, + ); + $stored_feed_links[$url] = drupal_render($feed_icon); drupal_add_html_head_link(array( 'rel' => 'alternate', diff --git a/core/includes/errors.inc b/core/includes/errors.inc index 3fe23b7..a8257f2 100644 --- a/core/includes/errors.inc +++ b/core/includes/errors.inc @@ -276,7 +276,11 @@ function _drupal_log_error($error, $fatal = FALSE) { // We fallback to a maintenance page at this point, because the page generation // itself can generate errors. // Should not translate the string to avoid errors producing more errors. - $output = theme('maintenance_page', array('content' => 'The website has encountered an error. Please try again later.')); + $maintenance_page = array( + '#theme' => 'maintenance_page', + '#content' => 'The website has encountered an error. Please try again later.', + ); + $output = drupal_render($maintenance_page); $response = new Response($output, 500); if ($fatal) { diff --git a/core/includes/form.inc b/core/includes/form.inc index d63596e..d2d6bc7 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -3523,7 +3523,14 @@ function theme_tableselect($variables) { array_unshift($header, ''); } } - return theme('table', array('header' => $header, 'rows' => $rows, 'empty' => $element['#empty'], 'attributes' => $element['#attributes'])); + $table = array( + '#theme' => 'table', + '#header' => $header, + '#rows' => $rows, + '#empty' => $element['#empty'], + '#attributes' => $element['#attributes'], + ); + return drupal_render($table); } /** @@ -4712,17 +4719,23 @@ function theme_form_element($variables) { } $prefix = isset($element['#field_prefix']) ? '' . $element['#field_prefix'] . ' ' : ''; $suffix = isset($element['#field_suffix']) ? ' ' . $element['#field_suffix'] . '' : ''; + $form_element_label = array('#theme' => 'form_element_label'); + foreach (array('#title', '#title_display', '#required', '#id') as $key) { + if (isset($element[$key]) || array_key_exists($key, $element)) { + $form_element_label[$key] = $element[$key]; + } + } switch ($element['#title_display']) { case 'before': case 'invisible': - $output .= ' ' . theme('form_element_label', $variables); + $output .= ' ' . drupal_render($form_element_label); $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n"; break; case 'after': $output .= ' ' . $prefix . $element['#children'] . $suffix; - $output .= ' ' . theme('form_element_label', $variables) . "\n"; + $output .= ' ' . drupal_render($form_element_label) . "\n"; break; case 'none': @@ -4755,11 +4768,16 @@ function theme_form_element($variables) { * @ingroup themeable */ function theme_form_required_marker($variables) { - $attributes = array( - 'class' => 'form-required', - 'title' => t('This field is required.'), - ); - return '*'; + if (!empty($variables['element']['#required'])) { + $attributes = array( + 'class' => 'form-required', + 'title' => t('This field is required.'), + ); + return '*'; + } + else { + return ''; + } } /** @@ -4794,7 +4812,11 @@ function theme_form_element_label($variables) { } // If the element is required, a required marker is appended to the label. - $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : ''; + $form_required_marker = array('#theme' => 'form_required_marker'); + if (!empty($element['#required'])) { + $form_required_marker['#required'] = $element['#required']; + } + $required = drupal_render($form_required_marker); $title = filter_xss_admin($element['#title']); diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 8789366..8b17ed4 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -949,9 +949,19 @@ function install_display_output($output, $install_state) { // Let the theming function know when every step of the installation has // been completed. $active_task = $install_state['installation_finished'] ? NULL : $install_state['active_task']; - drupal_add_region_content('sidebar_first', theme('task_list', array('items' => install_tasks_to_display($install_state), 'active' => $active_task, 'variant' => 'install'))); + $task_list = array( + '#theme' => 'task_list', + '#items' => install_tasks_to_display($install_state), + '#active' => $active_task, + '#variant' => 'install', + ); + drupal_add_region_content('sidebar_first', drupal_render($task_list)); } - print theme('install_page', array('content' => $output)); + $install_page = array( + '#theme' => 'install_page', + '#content' => $output, + ); + print drupal_render($install_page); exit; } @@ -2352,9 +2362,13 @@ function install_display_requirements($install_state, $requirements) { if ($severity == REQUIREMENT_ERROR || ($severity == REQUIREMENT_WARNING && empty($install_state['parameters']['continue']))) { if ($install_state['interactive']) { drupal_set_title(t('Requirements problem')); - $status_report = theme('status_report', array('requirements' => $requirements)); - $status_report .= t('Check the messages and try again.', array('!url' => check_url(drupal_requirements_url($severity)))); - return $status_report; + $status_report = array( + '#theme' => 'status_report', + '#requirements' => $requirements, + ); + $output = drupal_render($status_report); + $output .= t('Check the messages and try again.', array('!url' => check_url(drupal_requirements_url($severity)))); + return $output; } else { // Throw an exception showing any unmet requirements. diff --git a/core/includes/tablesort.inc b/core/includes/tablesort.inc index c42b1f4..a9bbc56 100644 --- a/core/includes/tablesort.inc +++ b/core/includes/tablesort.inc @@ -49,7 +49,11 @@ function tablesort_header($cell, $header, $ts) { $cell['aria-sort'] = ($ts['sort'] == 'asc') ? 'ascending' : 'descending'; $ts['sort'] = (($ts['sort'] == 'asc') ? 'desc' : 'asc'); $cell['class'][] = 'active'; - $image = theme('tablesort_indicator', array('style' => $ts['sort'])); + $tablesort_indicator = array( + '#theme' => 'tablesort_indicator', + '#style' => $ts['sort'], + ); + $image = drupal_render($tablesort_indicator); } else { // If the user clicks a different header, we want to sort ascending initially. diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 5296b08..58fc418 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2304,7 +2304,14 @@ function theme_item_list($variables) { */ function theme_feed_icon($variables) { $text = t('Subscribe to !feed-title', array('!feed-title' => $variables['title'])); - if ($image = theme('image', array('uri' => 'core/misc/feed.png', 'width' => 16, 'height' => 16, 'alt' => $text))) { + $build = array( + '#theme' => 'image', + '#uri' => 'core/misc/feed.png', + '#width' => 16, + '#height' => 16, + '#alt' => $text, + ); + if ($image = drupal_render($build)) { return l($image, $variables['url'], array('html' => TRUE, 'attributes' => array('class' => array('feed-icon'), 'title' => $text))); } } @@ -2873,6 +2880,7 @@ function template_preprocess_maintenance_page(&$variables) { ); drupal_render($default_css); + $status_messages = array('#theme' => 'status_messages'); $variables['head_title_array'] = $head_title; $variables['head_title'] = implode(' | ', $head_title); $variables['base_path'] = base_path(); @@ -2883,7 +2891,7 @@ function template_preprocess_maintenance_page(&$variables) { $variables['language'] = $language_interface; $variables['language']->dir = $language_interface->direction ? 'rtl' : 'ltr'; $variables['logo'] = theme_get_setting('logo.url'); - $variables['messages'] = $variables['show_messages'] ? theme('status_messages') : ''; + $variables['messages'] = $variables['show_messages'] ? drupal_render($status_messages) : ''; $variables['main_menu'] = array(); $variables['secondary_menu'] = array(); $variables['site_name'] = (theme_get_setting('features.name') ? check_plain($site_name) : ''); diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc index 5c35ac3..61e5ee5 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -170,9 +170,19 @@ function theme_authorize_report($variables) { if ($number === '#abort') { continue; } - $items[] = theme('authorize_message', array('message' => $log_message['message'], 'success' => $log_message['success'])); + $authorize_message = array( + '#theme' => 'authorize_message', + '#message' => $log_message['message'], + '#success' => $log_message['success'], + ); + $items[] = drupal_render($authorize_message); } - $output .= theme('item_list', array('items' => $items, 'title' => $heading)); + $item_list = array( + '#theme' => 'item_list', + '#items' => $items, + '#title' => $heading, + ); + $output .= drupal_render($item_list); } $output .= ''; }