You are here

function answers_field_get_node_reference in Answers 7.3

Same name and namespace in other branches
  1. 7.2 includes/answers.field_utils.inc \answers_field_get_node_reference()

Returns a referenced node for a given field.

Parameters

object $source_node: The node that contains the reference to another node.

string $field: The reference field name.

Return value

object A fully loaded node object.

1 call to answers_field_get_node_reference()
_answers_notify_node_insert in includes/answers.notify.inc
Pseudo implementation of hook_node_insert().

File

includes/answers.field_utils.inc, line 35
Field utility functions for the 'Answers' module.

Code

function answers_field_get_node_reference($source_node, $field) {
  $items = field_get_items('node', $source_node, $field);
  $target_nid = $items[0]['nid'];
  return node_load($target_nid);
}