You are here

function _image_attach_node_load_attached in Image 6

Helper function for hook_nodeapi: view op. Loads all the required attached image nodes.

Parameters

$attached_nids: An array of node ids.

$teaser: If true, only load the first of the node ids.

Return value

An numerical array of node objects.

1 call to _image_attach_node_load_attached()
image_attach_nodeapi in contrib/image_attach/image_attach.module
Implementation of hook_nodeapi().

File

contrib/image_attach/image_attach.module, line 566
image_attach.module

Code

function _image_attach_node_load_attached($attached_nids, $teaser = FALSE) {
  if ($teaser) {

    // For the teaser we only want the first image from $attached_nids.
    // During normal node viewing the array is zero-keyed but during edit
    // preview it is keyed by iid. Therefore using array_shift() will return the
    // first image for either of these situations.
    $attached_nids = array(
      array_shift($attached_nids),
    );
  }
  foreach ($attached_nids as $nid) {
    $nodes[] = node_load($nid);
  }
  return $nodes;
}