I'm not sure there's an API function to get this directly; the field functions (like field_get_items()
) seem to rely on a loaded entity object, which in the case of a node would have gone through the whole loading process.
If you want to get the value directly you'll find the data in the field_data_field_*
tables. A query like the following would get the data for a node of type 'article', assuming a text field called 'field_my_field' with a column name of 'value'. It also assumes the field is not multiple; if it is you'll need to remove the last line of the query and loop through $val
instead:
$val = db_select('field_data_field_my_field', 'f')
->fields('f', array('field_my_field_value'))
->condition('entity_type', 'node')
->condition('bundle', 'article')
->condition('entity_id', $node->nid)
->execute()
->fetchField();
If you've got node revisions turned on for the content type in question you'll probably need to alter this to query the field_revision_field_my_field
table instead, and use the node revision id (vid
) instead.