node_build_multiple

Versions
7
node_build_multiple($nodes, $build_mode = 'teaser', $weight = 0)

Construct a drupal_render() style array from an array of loaded nodes.

Parameters

$nodes An array of nodes as returned by node_load_multiple().

$build_mode Build mode, e.g. 'full', 'teaser'...

$weight An integer representing the weight of the first node in the list.

Return value

An array in the format expected by drupal_render().

▾ 5 functions call node_build_multiple()

blog_page_last in modules/blog/blog.pages.inc
Menu callback; displays a Drupal page containing recent blog entries of all users.
blog_page_user in modules/blog/blog.pages.inc
Menu callback; displays a Drupal page containing recent blog entries of a given user.
node_page_default in modules/node/node.module
Menu callback; Generate a listing of promoted nodes.
node_show in modules/node/node.module
Generate an array which displays a node detail page.
taxonomy_term_page in modules/taxonomy/taxonomy.pages.inc
Menu callback; displays all nodes associated with a term.

Code

modules/node/node.module, line 2104

<?php
function node_build_multiple($nodes, $build_mode = 'teaser', $weight = 0) {
  field_attach_prepare_view('node', $nodes, $build_mode);
  $build = array();
  foreach ($nodes as $node) {
    $build['nodes'][$node->nid] = node_build($node, $build_mode);
    $build['nodes'][$node->nid]['#weight'] = $weight;
    $weight++;
  }
  $build['nodes']['#sorted'] = TRUE;
  return $build;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.