Commit 6b098269 authored by catch's avatar catch

Issue #2009660 by jeroen12345, InternetDevels: Replace theme() with drupal_render() in node module.

parent 872c343d
......@@ -168,12 +168,13 @@ function render($row) {
$item->link = $node->link;
$item->elements = $node->rss_elements;
$item->nid = $node->nid;
return theme($this->themeFunctions(), array(
'view' => $this->view,
'options' => $this->options,
'row' => $item
));
$theme_function = array(
'#theme' => $this->themeFunctions(),
'#view' => $this->view,
'#options' => $this->options,
'#row' => $item,
);
return drupal_render($theme_function);
}
}
......@@ -352,7 +352,11 @@ 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', array('items' => $results));
$item_list = array(
'#theme' => 'item_list',
'#items' => $results,
);
$message .= drupal_render($item_list);
drupal_set_message($message);
}
}
......@@ -495,12 +499,16 @@ function node_admin_nodes() {
);
foreach ($nodes as $node) {
$l_options = $node->langcode != Language::LANGCODE_NOT_SPECIFIED && isset($languages[$node->langcode]) ? array('language' => $languages[$node->langcode]) : array();
$mark = array(
'#theme' => 'mark',
'#type' => node_mark($node->nid, $node->changed),
);
$form['nodes'][$node->nid]['title'] = array(
'#type' => 'link',
'#title' => $node->label(),
'#href' => 'node/' . $node->nid,
'#options' => $l_options,
'#suffix' => ' ' . theme('mark', array('type' => node_mark($node->nid, $node->changed))),
'#suffix' => ' ' . drupal_render($mark),
);
$form['nodes'][$node->nid]['type'] = array(
'#markup' => check_plain(node_get_type_label($node)),
......
......@@ -1082,10 +1082,12 @@ function template_preprocess_node(&$variables) {
$variables['date'] = format_date($node->created);
// @todo Change 'name' to 'author' and also convert to a render array pending
// http://drupal.org/node/1941286.
$variables['name'] = theme('username', array(
'account' => $node,
'link_attributes' => array('rel' => 'author'),
));
$username = array(
'#theme' => 'username',
'#account' => $node,
'#link_attributes' => array('rel' => 'author'),
);
$variables['name'] = drupal_render($username);
$uri = $node->uri();
$variables['node_url'] = url($uri['path'], $uri['options']);
......@@ -1336,11 +1338,15 @@ function node_search_execute($keys = NULL, $conditions = NULL) {
$language = language_load($item->langcode);
$uri = $node->uri();
$username = array(
'#theme' => 'username',
'#account' => $node,
);
$results[] = array(
'link' => url($uri['path'], array_merge($uri['options'], array('absolute' => TRUE, 'language' => $language))),
'type' => check_plain(node_get_type_label($node)),
'title' => $node->label($item->langcode),
'user' => theme('username', array('account' => $node)),
'user' => drupal_render($username),
'date' => $node->changed,
'node' => $node,
'extra' => $extra,
......@@ -1466,7 +1472,12 @@ function theme_node_search_admin($variables) {
$row[] = drupal_render($form['factors'][$key]);
$rows[] = $row;
}
$output .= theme('table', array('header' => $header, 'rows' => $rows));
$table = array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
);
$output .= drupal_render($table);
$output .= drupal_render_children($form);
return $output;
......@@ -1873,8 +1884,12 @@ function theme_node_recent_block($variables) {
$l_options = array('query' => drupal_get_destination());
foreach ($variables['nodes'] as $node) {
$row = array();
$node_recent_content = array(
'#theme' => 'node_recent_content',
'#node' => $node,
);
$row[] = array(
'data' => theme('node_recent_content', array('node' => $node)),
'data' => drupal_render($node_recent_content),
'class' => 'title-author',
);
if (node_access('update', $node)) {
......@@ -1893,9 +1908,18 @@ function theme_node_recent_block($variables) {
}
if ($rows) {
$output = theme('table', array('rows' => $rows));
$table = array(
'#theme' => 'table',
'#rows' => $rows,
);
$output = drupal_render($table);
if (user_access('access content overview')) {
$output .= theme('more_link', array('url' => 'admin/content', 'title' => t('Show more content')));
$more_link = array(
'#theme' => 'more_link',
'#url' => 'admin/content',
'#title' => t('Show more content'),
);
$output .= drupal_render($more_link);
}
}
......@@ -1916,9 +1940,17 @@ function theme_node_recent_content($variables) {
$output = '<div class="node-title">';
$output .= l($node->label(), 'node/' . $node->nid);
$output .= theme('mark', array('type' => node_mark($node->nid, $node->changed)));
$mark = array(
'#theme' => 'mark',
'#type' => node_mark($node->nid, $node->changed),
);
$output .= drupal_render($mark);
$output .= '</div><div class="node-author">';
$output .= theme('username', array('account' => user_load($node->uid)));
$username = array(
'#theme' => 'username',
'#account' => user_load($node->uid),
);
$output .= drupal_render($username);
$output .= '</div>';
return $output;
......
......@@ -148,7 +148,11 @@ function node_preview(EntityInterface $node) {
// Display a preview of the node.
if (!form_get_errors()) {
$node->in_preview = TRUE;
$output = theme('node_preview', array('node' => $node));
$node_preview = array(
'#theme' => 'node_preview',
'#node' => $node,
);
$output = drupal_render($node_preview);
unset($node->in_preview);
}
......@@ -265,13 +269,21 @@ function node_revision_overview($node) {
$row = array();
$type = $node->type;
if ($revision->current_vid > 0) {
$row[] = array('data' => t('!date by !username', array('!date' => l(format_date($revision->revision_timestamp, 'short'), "node/$node->nid"), '!username' => theme('username', array('account' => $revision))))
$username = array(
'#theme' => 'username',
'#account' => $revision,
);
$row[] = array('data' => t('!date by !username', array('!date' => l(format_date($revision->revision_timestamp, 'short'), "node/$node->nid"), '!username' => drupal_render($username)))
. (($revision->log != '') ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : ''),
'class' => array('revision-current'));
$row[] = array('data' => drupal_placeholder(t('current revision')), 'class' => array('revision-current'));
}
else {
$row[] = t('!date by !username', array('!date' => l(format_date($revision->revision_timestamp, 'short'), "node/$node->nid/revisions/$revision->vid/view"), '!username' => theme('username', array('account' => $revision))))
$username = array(
'#theme' => 'username',
'#account' => $revision,
);
$row[] = t('!date by !username', array('!date' => l(format_date($revision->revision_timestamp, 'short'), "node/$node->nid/revisions/$revision->vid/view"), '!username' => drupal_render($username)))
. (($revision->log != '') ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : '');
if ($revert_permission) {
$links['revert'] = array(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment