How should I get the value contained in a particular field of a Drupal 7 custom node?
- by Matt V.
What is the "proper" way to get the value stored in a particular field within a custom Drupal node? I've created a custom module, with a custom node, with a custom URL field. The following works:
$result = db_query("SELECT nid FROM {node} WHERE title = :title AND type = :type", array(
':title' => $title,
':type' => 'custom',
))->fetchField();
$node = node_load($result);
$url = $node->url['und']['0']['value'];
...but is there a better way, maybe using the new Field API functions?