? .DS_Store
? .patch
? drupal.hook-page-alter_0.patch
? t.patch
Index: index.php
===================================================================
RCS file: /cvs/drupal/drupal/index.php,v
retrieving revision 1.96
diff -u -p -r1.96 index.php
--- index.php 20 Sep 2008 20:22:23 -0000 1.96
+++ index.php 27 Jan 2009 00:14:17 -0000
@@ -21,7 +21,7 @@ require_once DRUPAL_ROOT . '/includes/bo
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$return = menu_execute_active_handler();
-// Menu status constants are integers; page content is a string.
+// Menu status constants are integers; page content is a string or array.
if (is_int($return)) {
switch ($return) {
case MENU_NOT_FOUND:
@@ -36,8 +36,8 @@ if (is_int($return)) {
}
}
elseif (isset($return)) {
- // Print any value (including an empty string) except NULL or undefined:
- print theme('page', $return);
+ // Print anything besides a menu constant, assuming it's not NULL or undefined.
+ print drupal_render_page($return);
}
drupal_page_footer();
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.856
diff -u -p -r1.856 common.inc
--- includes/common.inc 23 Jan 2009 14:23:27 -0000 1.856
+++ includes/common.inc 27 Jan 2009 00:14:17 -0000
@@ -301,8 +301,7 @@ function drupal_get_destination() {
* Drupal will ensure that messages set by drupal_set_message() and other
* session data are written to the database before the user is redirected.
*
- * This function ends the request; use it rather than a print theme('page')
- * statement in your menu callback.
+ * This function ends the request; use it instead of a return in your menu callback.
*
* @param $path
* A Drupal path or a full URL.
@@ -379,19 +378,23 @@ function drupal_not_found() {
$path = drupal_get_normal_path(variable_get('site_404', ''));
if ($path && $path != $_GET['q']) {
- // Set the active item in case there are tabs to display, or other
- // dependencies on the path.
+ // Custom 404 handler. Set the active item in case there are tabs to
+ // display, or other dependencies on the path.
menu_set_active_item($path);
$return = menu_execute_active_handler($path);
}
if (empty($return) || $return == MENU_NOT_FOUND || $return == MENU_ACCESS_DENIED) {
+ // Standard 404 handler.
drupal_set_title(t('Page not found'));
$return = t('The requested page could not be found.');
}
+ $page = drupal_get_page($return);
// To conserve CPU and bandwidth, omit the blocks.
- print theme('page', $return, FALSE);
+ $page['#show_blocks'] = FALSE;
+
+ print drupal_render_page($page);
}
/**
@@ -408,17 +411,19 @@ function drupal_access_denied() {
$path = drupal_get_normal_path(variable_get('site_403', ''));
if ($path && $path != $_GET['q']) {
- // Set the active item in case there are tabs to display or other
- // dependencies on the path.
+ // Custom 403 handler. Set the active item in case there are tabs to
+ // display or other dependencies on the path.
menu_set_active_item($path);
$return = menu_execute_active_handler($path);
}
if (empty($return) || $return == MENU_NOT_FOUND || $return == MENU_ACCESS_DENIED) {
+ // Standard 403 handler.
drupal_set_title(t('Access denied'));
$return = t('You are not authorized to access this page.');
}
- print theme('page', $return);
+
+ print drupal_render_page($return);
}
/**
@@ -816,7 +821,10 @@ function _drupal_log_error($error, $fata
drupal_set_header($_SERVER['SERVER_PROTOCOL'] . ' Service unavailable');
drupal_set_title(t('Error'));
if (!defined('MAINTENANCE_MODE') && drupal_get_bootstrap_phase() == DRUPAL_BOOTSTRAP_FULL) {
- print theme('page', t('The website encountered an unexpected error. Please try again later.'), FALSE);
+ // To conserve CPU and bandwidth, omit the blocks.
+ $page = drupal_get_page(t('The website encountered an unexpected error. Please try again later.'));
+ $page['#show_blocks'] = FALSE;
+ print drupal_render_page($page);
}
else {
print theme('maintenance_page', t('The website encountered an unexpected error. Please try again later.'), FALSE);
@@ -3195,6 +3203,53 @@ function drupal_alter($type, &$data) {
}
/**
+ * Retrieve a $page element that is ready for decorating.
+ *
+ * Used by menu callbacks in order to populate the page with content
+ * and behavior (e.g. #show_blocks).
+ *
+ * @param $content
+ * A string or renderable array representing the body of the page.
+ * @return
+ * A $page element that should be decorated and then passed to drupal_render_page().
+ *
+ * @see drupal_render_page().
+ */
+function drupal_get_page($content = NULL) {
+ // Initialize page array with defaults. @see hook_elements() - 'page' element.
+ $page = _element_info('page');
+ $page['content'] = is_array($content) ? $content : array('main' => array('#markup' => $content));
+
+ return $page;
+}
+
+/**
+ * Renders the page, including all theming.
+ *
+ * @param $page
+ * A string or array representing the content of a page. The array consists of
+ * the following keys:
+ * - #type: Value is always 'page'. This pushes the theming through page.tpl.php (required).
+ * - content: A renderable array as built by the menu callback (required).
+ * - #show_blocks: A marker which suppresses left/right regions if FALSE (optional).
+ * - #show_messages: Suppress drupal_get_message() items. Used by Batch API (optional).
+ *
+ * @see hook_page_alter()
+ * @see drupal_get_page()
+ */
+function drupal_render_page($page) {
+ // Allow menu callbacks to return strings.
+ if (is_string($page)) {
+ $page = drupal_get_page($page);
+ }
+ // Modules alter the $page as needed. Blocks are populated into regions like
+ // 'left', 'footer', etc.
+ drupal_alter('page', $page);
+
+ return drupal_render($page);
+}
+
+/**
* Renders HTML given a structured array tree.
*
* Recursively iterates over each of the array elements, generating HTML code.
@@ -3366,7 +3421,7 @@ function drupal_common_theme() {
'arguments' => array('text' => NULL)
),
'page' => array(
- 'arguments' => array('content' => NULL, 'show_blocks' => TRUE, 'show_messages' => TRUE),
+ 'arguments' => array('page' => NULL),
'template' => 'page',
),
'maintenance_page' => array(
@@ -3425,6 +3480,9 @@ function drupal_common_theme() {
'item_list' => array(
'arguments' => array('items' => array(), 'title' => NULL, 'type' => 'ul', 'attributes' => NULL),
),
+ 'list' => array(
+ 'arguments' => array('elements' => NULL),
+ ),
'more_help_link' => array(
'arguments' => array('url' => NULL),
),
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.465
diff -u -p -r1.465 theme.inc
--- includes/theme.inc 26 Jan 2009 14:08:40 -0000 1.465
+++ includes/theme.inc 27 Jan 2009 00:14:18 -0000
@@ -1569,6 +1569,25 @@ function theme_item_list($items = array(
}
/**
+ * Return a themed list of items from a drupal_render() style array.
+ *
+ * @param $elements
+ * An array consisting of the following keys:
+ * - #items: an array of items as expected by theme('item_list').
+ * - #title: a title which prints above the list.
+ * - #list_type: the type of list to return. Defaults to "ul".
+ * - #attributes: an array of attributes as expected by theme('item_list').
+ * @return
+ * A string containing the list output.
+ */
+function theme_list($elements) {
+ // Populate any missing array elements with their defaults.
+ $elements += _element_info('list');
+
+ return theme('item_list', $elements['#items'], $elements['#title'], $elements['#list_type'], $elements['#attributes']);
+}
+
+/**
* Returns code that emits the 'more help'-link.
*/
function theme_more_help_link($url) {
@@ -1631,30 +1650,6 @@ function theme_closure($main = 0) {
}
/**
- * Return a set of blocks available for the current user.
- *
- * @param $region
- * Which set of blocks to retrieve.
- * @return
- * A string containing the themed blocks for this region.
- */
-function theme_blocks($region) {
- $output = '';
-
- if ($list = block_list($region)) {
- foreach ($list as $key => $block) {
- // $key == module_delta
- $output .= theme('block', $block);
- }
- }
-
- // Add any content assigned to this region through drupal_set_content() calls.
- $output .= drupal_get_content($region);
-
- return $output;
-}
-
-/**
* Format a username.
*
* @param $object
@@ -1816,32 +1811,26 @@ function template_preprocess(&$variables
* Any changes to variables in this preprocessor should also be changed inside
* template_preprocess_maintenance_page() to keep all of them consistent.
*
- * The $variables array contains the following arguments:
- * - $content
- * - $show_blocks
+ * The $variables array contains two keys:
+ * - 'page': the fully decorated page.
+ * - 'content': the content of the page, already rendered.
*
+ * @see drupal_render_page
* @see page.tpl.php
*/
function template_preprocess_page(&$variables) {
- // Add favicon
- if (theme_get_setting('toggle_favicon')) {
- drupal_set_html_head('');
+ // Move some variables to the top level for themer convenience and template cleanliness.
+ $variables['show_blocks'] = $variables['page']['#show_blocks'];
+ $variables['show_messages'] = $variables['page']['#show_messages'];
+
+ // Render each region into top level variables.
+ foreach (system_region_list($GLOBALS['theme']) as $region_key => $region_name) {
+ $variables[$region_key] = empty($variables['page'][$region_key]) ? '' : drupal_render($variables['page'][$region_key]);
}
- global $theme;
- // Populate all block regions.
- $regions = system_region_list($theme);
- // Load all region content assigned via blocks.
- foreach (array_keys($regions) as $region) {
- // Prevent left and right regions from rendering blocks when 'show_blocks' == FALSE.
- if ($variables['show_blocks'] || ($region != 'left' && $region != 'right')) {
- $blocks = theme('blocks', $region);
- }
- else {
- $blocks = '';
- }
- // Assign region to a region variable.
- isset($variables[$region]) ? $variables[$region] .= $blocks : $variables[$region] = $blocks;
+ // Add favicon.
+ if (theme_get_setting('toggle_favicon')) {
+ drupal_set_html_head('');
}
// Set up layout variable.
@@ -1881,8 +1870,8 @@ function template_preprocess_page(&$vari
$variables['logo'] = theme_get_setting('logo');
$variables['messages'] = $variables['show_messages'] ? theme('status_messages') : '';
$variables['mission'] = isset($mission) ? $mission : '';
- $variables['main_menu'] = theme_get_setting('toggle_main_menu') ? menu_main_menu() : array();
- $variables['secondary_menu'] = theme_get_setting('toggle_secondary_menu') ? menu_secondary_menu() : array();
+ $variables['main_menu'] = theme_get_setting('toggle_main_menu') ? menu_main_menu() : array();
+ $variables['secondary_menu'] = theme_get_setting('toggle_secondary_menu') ? menu_secondary_menu() : array();
$variables['search_box'] = (theme_get_setting('toggle_search') ? drupal_get_form('search_theme_form') : '');
$variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : '');
$variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : '');
@@ -1975,6 +1964,8 @@ function template_preprocess_page(&$vari
* @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);
@@ -2035,6 +2026,7 @@ function template_preprocess_node(&$vari
*/
function template_preprocess_block(&$variables) {
static $block_counter = array();
+ $variables['block'] = $variables['block']['#block'];
// All blocks get an independent counter for each region.
if (!isset($block_counter[$variables['block']->region])) {
$block_counter[$variables['block']->region] = 1;
Index: modules/block/block.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.admin.inc,v
retrieving revision 1.32
diff -u -p -r1.32 block.admin.inc
--- modules/block/block.admin.inc 16 Dec 2008 23:57:31 -0000 1.32
+++ modules/block/block.admin.inc 27 Jan 2009 00:14:18 -0000
@@ -368,8 +368,6 @@ function template_preprocess_block_admin
$variables['block_regions'] = $block_regions + array(BLOCK_REGION_NONE => t('Disabled'));
foreach ($block_regions as $key => $value) {
- // Highlight regions on page to provide visual reference.
- drupal_set_content($key, '
' . $value . '
');
// Initialize an empty array for the region.
$variables['block_listing'][$key] = array();
}
Index: modules/block/block.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.module,v
retrieving revision 1.319
diff -u -p -r1.319 block.module
--- modules/block/block.module 21 Jan 2009 16:58:41 -0000 1.319
+++ modules/block/block.module 27 Jan 2009 00:14:18 -0000
@@ -226,6 +226,61 @@ function block_block_view($delta = 0, $e
}
/**
+ * Implementation of hook_page_alter().
+ *
+ * Render blocks into their regions.
+ */
+function block_page_alter($page) {
+ global $theme;
+
+ // The theme system might not yet be initialized. We need $theme.
+ init_theme();
+
+ // Populate all block regions
+ $regions = system_region_list($theme);
+
+ // Load all region content assigned via blocks.
+ foreach (array_keys($regions) as $region) {
+ // Prevent left and right regions from rendering blocks when 'show_blocks' == FALSE.
+ if ($page['#show_blocks'] || ($region != 'left' && $region != 'right')) {
+ // Assign blocks to region.
+ if ($blocks = block_get_blocks_by_region($region)) {
+ $page[$region]['blocks'] = $blocks;
+ }
+
+ // Append region description if we are rendering the block admin page.
+ $item = menu_get_item();
+ if ($item['path'] == 'admin/build/block') {
+ $description = '
' . $regions[$region] . '
';
+ $page[$region]['blocks']['block_description'] = array('#markup' => $description);
+ }
+ }
+ }
+}
+
+/**
+ * Get a renderable array of a region containing all enabled blocks.
+ *
+ * @param $region
+ * The requested region.
+ */
+function block_get_blocks_by_region($region) {
+ $weight = 0;
+ $build = array();
+ if ($list = block_list($region)) {
+ foreach ($list as $key => $block) {
+ $build[$key] = array(
+ '#theme' => 'block',
+ '#block' => $block,
+ '#weight' => ++$weight,
+ );
+ }
+ $build['#sorted'] = TRUE;
+ }
+ return $build;
+}
+
+/**
* Update the 'block' DB table with the blocks currently exported by modules.
*
* @return
Index: modules/blog/blog.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog/blog.pages.inc,v
retrieving revision 1.14
diff -u -p -r1.14 blog.pages.inc
--- modules/blog/blog.pages.inc 13 Oct 2008 00:33:01 -0000 1.14
+++ modules/blog/blog.pages.inc 27 Jan 2009 00:14:18 -0000
@@ -23,18 +23,20 @@ function blog_page_user($account) {
$items[] = t('You are not allowed to post a new blog entry.');
}
- $output = theme('item_list', $items);
-
- $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $account->uid);
- $has_posts = FALSE;
-
- while ($node = db_fetch_object($result)) {
- $output .= node_view(node_load($node->nid), 1);
- $has_posts = TRUE;
- }
-
- if ($has_posts) {
- $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
+ $build['blog_actions'] = array(
+ '#items' => $items,
+ '#theme' => 'list',
+ '#weight' => -1,
+ );
+
+ $nids = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $account->uid)->fetchCol();
+ if (!empty($nids)) {
+ $nodes = node_load_multiple($nids);
+ $build += node_build_multiple($nodes);
+ $build['pager'] = array(
+ '#markup' => theme('pager', NULL, variable_get('default_nodes_main', 10)),
+ '#weight' => 5,
+ );
}
else {
if ($account->uid == $user->uid) {
@@ -46,7 +48,7 @@ function blog_page_user($account) {
}
drupal_add_feed(url('blog/' . $account->uid . '/feed'), t('RSS - !title', array('!title' => $title)));
- return $output;
+ return drupal_get_page($build);
}
/**
@@ -54,33 +56,33 @@ function blog_page_user($account) {
*/
function blog_page_last() {
global $user;
-
- $output = '';
- $items = array();
+ $build = array();
if (user_access('edit own blog')) {
$items[] = l(t('Create new blog entry.'), "node/add/blog");
- }
-
- $output = theme('item_list', $items);
-
- $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10));
- $has_posts = FALSE;
-
- while ($node = db_fetch_object($result)) {
- $output .= node_view(node_load($node->nid), 1);
- $has_posts = TRUE;
- }
-
- if ($has_posts) {
- $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
+ $build['blog_actions'] = array(
+ '#items' => $items,
+ '#theme' => 'list',
+ '#weight' => -1,
+ );
+ }
+
+ $nids = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10))->fetchCol();
+
+ if (!empty($nids)) {
+ $nodes = node_load_multiple($nids);
+ $build += node_build_multiple($nodes);
+ $build['pager'] = array(
+ '#markup' => theme('pager', NULL, variable_get('default_nodes_main', 10)),
+ '#weight' => 5,
+ );
}
else {
drupal_set_message(t('No blog entries have been created.'));
}
drupal_add_feed(url('blog/feed'), t('RSS - blogs'));
- return $output;
+ return drupal_get_page($build);
}
/**
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.687
diff -u -p -r1.687 comment.module
--- modules/comment/comment.module 26 Jan 2009 14:08:42 -0000 1.687
+++ modules/comment/comment.module 27 Jan 2009 00:14:18 -0000
@@ -1649,7 +1649,7 @@ function comment_form_add_preview($form,
}
else {
$suffix = empty($form['#suffix']) ? '' : $form['#suffix'];
- $form['#suffix'] = $suffix . node_view($node);
+ $form['#suffix'] = $suffix . drupal_render(node_build($node));
$edit['pid'] = 0;
}
Index: modules/comment/comment.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.pages.inc,v
retrieving revision 1.11
diff -u -p -r1.11 comment.pages.inc
--- modules/comment/comment.pages.inc 31 Dec 2008 12:02:21 -0000 1.11
+++ modules/comment/comment.pages.inc 27 Jan 2009 00:14:18 -0000
@@ -92,7 +92,7 @@ function comment_reply($node, $pid = NUL
}
// This is the case where the comment is in response to a node. Display the node.
elseif (user_access('access content')) {
- $output .= node_view($node);
+ $output .= drupal_render(node_build($node));
}
// Should we show the reply box?
Index: modules/node/node.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.api.php,v
retrieving revision 1.8
diff -u -p -r1.8 node.api.php
--- modules/node/node.api.php 26 Jan 2009 14:08:43 -0000 1.8
+++ modules/node/node.api.php 27 Jan 2009 00:14:18 -0000
@@ -81,7 +81,7 @@ function hook_node_access_records($node)
return;
}
- // We only care about the node if it's been marked private. If not, it is
+ // We only care about the node if it has been marked private. If not, it is
// treated just like any other node and we completely ignore it.
if ($node->private) {
$grants = array();
@@ -169,7 +169,7 @@ function hook_node_operations() {
* @return
* None.
*/
-function hook_nodeapi_alter($node, $teaser, $page) {
+function hook_nodeapi_alter($node, $teaser) {
}
/**
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1018
diff -u -p -r1.1018 node.module
--- modules/node/node.module 22 Jan 2009 12:46:06 -0000 1.1018
+++ modules/node/node.module 27 Jan 2009 00:14:18 -0000
@@ -96,7 +96,7 @@ function node_help($path, $arg) {
function node_theme() {
return array(
'node' => array(
- 'arguments' => array('node' => NULL, 'teaser' => FALSE, 'page' => FALSE),
+ 'arguments' => array('elements' => NULL),
'template' => 'node',
),
'node_list' => array(
@@ -1126,24 +1126,28 @@ function node_delete($nid) {
}
/**
- * Generate a display of the given node.
+ * Generate an array for rendering the given node.
*
* @param $node
* A node array or node object.
* @param $teaser
* Whether to display the teaser only or the full form.
- * @param $links
- * Whether or not to display node links. Links are omitted for node previews.
*
* @return
- * An HTML representation of the themed node.
+ * An array as expected by drupal_render().
*/
-function node_view($node, $teaser = FALSE) {
+function node_build($node, $teaser = FALSE) {
$node = (object)$node;
$node = node_build_content($node, $teaser);
- return theme('node', $node, $teaser);
+ $build = $node->content;
+ $build += array(
+ '#theme' => 'node',
+ '#node' => $node,
+ '#teaser' => $teaser,
+ );
+ return $build;
}
/**
@@ -1205,25 +1209,31 @@ function node_build_content($node, $teas
node_invoke_nodeapi($node, 'view', $teaser);
// Allow modules to modify the structured node.
- drupal_alter('node_view', $node, $teaser);
+ drupal_alter('node_build', $node, $teaser);
return $node;
}
/**
- * Generate a page displaying a single node.
+ * Generate an array which displays a node detail page.
+ *
+ * @param $node
+ * A node object.
+ * @param $message
+ * A flag which sets a page title relevant to the revision being viewed.
+ * @return
+ * A $page element suitable for use by drupal_page_render().
*/
function node_show($node, $message = FALSE) {
if ($message) {
drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title, '%date' => format_date($node->revision_timestamp))), PASS_THROUGH);
}
- $output = node_view($node, FALSE, TRUE);
-
// Update the history table, stating that this user viewed this node.
node_tag_new($node->nid);
- return $output;
+ // For markup consistency with other pages, use node_build_multiple() rather than node_build().
+ return drupal_get_page(node_build_multiple(array($node), FALSE));
}
/**
@@ -1905,20 +1915,43 @@ function node_feed($nids = FALSE, $chann
}
/**
+ * Construct a drupal_render() style array from an array of loaded nodes.
+ *
+ * @param $nodes
+ * An array of nodes as returned by node_load_multiple().
+ * @param $teaser
+ * Display nodes into teaser view or full view.
+ * @param $weight
+ * An integer representing the weight of the first node in the list.
+ * @return
+ * An array in the format expected by drupal_render().
+ */
+function node_build_multiple($nodes, $teaser = TRUE, $weight = 0) {
+ $build = array();
+ foreach ($nodes as $node) {
+ $build['nodes'][$node->nid] = node_build($node, $teaser);
+ $build['nodes'][$node->nid]['#weight'] = $weight;
+ $weight++;
+ }
+ $build['nodes']['#sorted'] = TRUE;
+ return $build;
+}
+
+/**
* Menu callback; Generate a listing of promoted nodes.
*/
function node_page_default() {
- $nids = pager_query(db_rewrite_sql('SELECT n.nid FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10))->fetchCol();
+ $nids = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10))->fetchCol();
if (!empty($nids)) {
$nodes = node_load_multiple($nids);
- $output = '';
- foreach ($nodes as $node) {
- $output .= node_view($node, TRUE);
- }
+ $build = node_build_multiple($nodes);
$feed_url = url('rss.xml', array('absolute' => TRUE));
drupal_add_feed($feed_url, variable_get('site_name', 'Drupal') . ' ' . t('RSS'));
- $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
+ $build['pager'] = array(
+ '#markup' => theme('pager', NULL, variable_get('default_nodes_main', 10)),
+ '#weight' => 5,
+ );
}
else {
$default_message = '
' . t('Start posting content Finally, you can create content for your website. This message will disappear once you have promoted a post to the front page.', array('@content' => url('node/add'))) . '
';
$default_message .= '';
$default_message .= '
' . t('For more information, please refer to the help section, or the online Drupal handbooks. You may also post at the Drupal forum, or view the wide range of other support options available.', array('@help' => url('admin/help'), '@handbook' => 'http://drupal.org/handbooks', '@forum' => 'http://drupal.org/forum', '@support' => 'http://drupal.org/support')) . '
',
+ );
}
drupal_set_title('');
-
- return $output;
+ return drupal_get_page($build);
}
/**
@@ -2969,7 +3004,7 @@ function node_unpublish_by_keyword_actio
*/
function node_unpublish_by_keyword_action($node, $context) {
foreach ($context['keywords'] as $keyword) {
- if (strstr(node_view(clone $node), $keyword) || strstr($node->title, $keyword)) {
+ if (strstr(drupal_render(node_build(clone $node)), $keyword) || strstr($node->title, $keyword)) {
$node->status = 0;
watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_get_types('name', $node), '%title' => $node->title));
break;
Index: modules/node/node.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v
retrieving revision 1.50
diff -u -p -r1.50 node.pages.inc
--- modules/node/node.pages.inc 22 Jan 2009 12:04:27 -0000 1.50
+++ modules/node/node.pages.inc 27 Jan 2009 00:14:18 -0000
@@ -415,12 +415,12 @@ function theme_node_preview($node) {
if ($preview_trimmed_version) {
drupal_set_message(t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. You can insert the delimiter "<!--break-->" (without the quotes) to fine-tune where your post gets split.'));
$output .= '