How should I get the value contained in a particular field of a Drupal 7 custom node?
Posted
by
Matt V.
on Stack Overflow
See other posts from Stack Overflow
or by Matt V.
Published on 2011-01-17T02:14:57Z
Indexed on
2011/01/17
3:53 UTC
Read the original article
Hit count: 215
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?
© Stack Overflow or respective owner