| 7 node.module | node_view_multiple($nodes, $view_mode = 'teaser', $weight = 0, $langcode = NULL) |
| 8 node.module | node_view_multiple($nodes, $view_mode = 'teaser', $weight = 0, $langcode = NULL) |
Construct a drupal_render() style array from an array of loaded nodes.
Parameters
$nodes: An array of nodes as returned by node_load_multiple().
$view_mode: View mode, e.g. 'full', 'teaser'...
$weight: An integer representing the weight of the first node in the list.
$langcode: (optional) A language code to use for rendering. Defaults to the global content language of the current request.
Return value
An array in the format expected by drupal_render().
5 calls to node_view_multiple()
File
- modules/
node/ node.module, line 2561 - The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.
Code
function node_view_multiple($nodes, $view_mode = 'teaser', $weight = 0, $langcode = NULL) {
field_attach_prepare_view('node', $nodes, $view_mode, $langcode);
entity_prepare_view('node', $nodes, $langcode);
$build = array();
foreach ($nodes as $node) {
$build['nodes'][$node->nid] = node_view($node, $view_mode, $langcode);
$build['nodes'][$node->nid]['#weight'] = $weight;
$weight++;
}
$build['nodes']['#sorted'] = TRUE;
return $build;
}
Login or register to post comments
Comments
Is it posssible to render data in table format?
Is it possible to format data in table format using this api function, instead of teaser or pager... ?