Commit 7f5afdee authored by Dries's avatar Dries

- Patch #363905 by dereine: move template_preproces_node/block out of theme.inc.

parent dc4d421b
......@@ -1995,65 +1995,3 @@ function template_page_suggestions($args) {
return $suggestions;
}
/**
* Process variables for node.tpl.php
*
* Most themes utilize their own copy of node.tpl.php. The default is located
* inside "modules/node/node.tpl.php". Look in there for the full list of
* variables.
*
* The $variables array contains the following arguments:
* - $node
* - $teaser
* - $page
*
* @see node.tpl.php
*/
function template_preprocess_node(&$variables) {
$variables['teaser'] = $variables['elements']['#teaser'];
$variables['node'] = $variables['elements']['#node'];
$node = $variables['node'];
$variables['date'] = format_date($node->created);
$variables['name'] = theme('username', $node);
$variables['node_url'] = url('node/' . $node->nid);
$variables['title'] = check_plain($node->title);
$variables['page'] = (bool)menu_get_object();
if ($node->build_mode == NODE_BUILD_PREVIEW) {
unset($node->content['links']);
}
// Render taxonomy links separately.
$variables['terms'] = !empty($node->content['links']['terms']) ? drupal_render($node->content['links']['terms']) : '';
// Render all remaining node links.
$variables['links'] = !empty($node->content['links']) ? drupal_render($node->content['links']) : '';
// Render any comments.
$variables['comments'] = !empty($node->content['comments']) ? drupal_render($node->content['comments']) : '';
// Render the rest of the node into $content.
$variables['content'] = drupal_render($node->content);
// Flatten the node object's member fields.
$variables = array_merge((array)$node, $variables);
// Display post information only on certain node types.
if (variable_get('node_submitted_' . $node->type, TRUE)) {
$variables['submitted'] = theme('node_submitted', $node);
$variables['picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', $node) : '';
}
else {
$variables['submitted'] = '';
$variables['picture'] = '';
}
// Clean up name so there are no underscores.
$variables['template_files'][] = 'node-' . str_replace('_', '-', $node->type);
$variables['template_files'][] = 'node-' . $node->nid;
// Add $FIELD_NAME_rendered variables for fields.
drupal_function_exists('field_attach_preprocess');
$variables += field_attach_preprocess('node', $node);
}
......@@ -1334,6 +1334,68 @@ function node_show($node, $message = FALSE) {
return node_build_multiple(array($node), FALSE);
}
/**
* Process variables for node.tpl.php
*
* Most themes utilize their own copy of node.tpl.php. The default is located
* inside "modules/node/node.tpl.php". Look in there for the full list of
* variables.
*
* The $variables array contains the following arguments:
* - $node
* - $teaser
* - $page
*
* @see node.tpl.php
*/
function template_preprocess_node(&$variables) {
$variables['teaser'] = $variables['elements']['#teaser'];
$variables['node'] = $variables['elements']['#node'];
$node = $variables['node'];
$variables['date'] = format_date($node->created);
$variables['name'] = theme('username', $node);
$variables['node_url'] = url('node/' . $node->nid);
$variables['title'] = check_plain($node->title);
$variables['page'] = (bool)menu_get_object();
if ($node->build_mode == NODE_BUILD_PREVIEW) {
unset($node->content['links']);
}
// Render taxonomy links separately.
$variables['terms'] = !empty($node->content['links']['terms']) ? drupal_render($node->content['links']['terms']) : '';
// Render all remaining node links.
$variables['links'] = !empty($node->content['links']) ? drupal_render($node->content['links']) : '';
// Render any comments.
$variables['comments'] = !empty($node->content['comments']) ? drupal_render($node->content['comments']) : '';
// Render the rest of the node into $content.
$variables['content'] = drupal_render($node->content);
// Flatten the node object's member fields.
$variables = array_merge((array)$node, $variables);
// Display post information only on certain node types.
if (variable_get('node_submitted_' . $node->type, TRUE)) {
$variables['submitted'] = theme('node_submitted', $node);
$variables['picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', $node) : '';
}
else {
$variables['submitted'] = '';
$variables['picture'] = '';
}
// Clean up name so there are no underscores.
$variables['template_files'][] = 'node-' . str_replace('_', '-', $node->type);
$variables['template_files'][] = 'node-' . $node->nid;
// Add $FIELD_NAME_rendered variables for fields.
drupal_function_exists('field_attach_preprocess');
$variables += field_attach_preprocess('node', $node);
}
/**
* Theme a log message.
*
......
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