You are here

function library_get_node_by_item_id in Library 7

Same name and namespace in other branches
  1. 5.2 library.module \library_get_node_by_item_id()
  2. 6.2 library.module \library_get_node_by_item_id()
  3. 6 library.module \library_get_node_by_item_id()

Returns the full node for an item_id.

Parameters

int $id: An item id (library_id).

Return value

object A node object if present.

File

./library.module, line 1158

Code

function library_get_node_by_item_id($id) {
  $result = db_query("SELECT nid FROM {library} WHERE id = :id", array(
    ':id' => $id,
  ));

  // @todo Ideally check if record present, else return false explicitly.
  $record = $result
    ->fetchField();
  $node = node_load($record);
  return $node;
}