Skip to content

Instantly share code, notes, and snippets.

@larowlan
Created December 18, 2013 04:05
Show Gist options
  • Save larowlan/8017121 to your computer and use it in GitHub Desktop.
Save larowlan/8017121 to your computer and use it in GitHub Desktop.
$node = node_load(1);
// I want field_foobar;
$value = FALSE;
if ($items = field_get_items('node', 'field_foobar')) {
$item = reset($items);
// A lot of fields use value, some use target_id, tid, it depends on their hook_field_schema.
// Good luck with that.
$value = $item['value'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment