field_test_entity_test_load
- Versions
- 7
field_test_entity_test_load($ftid, $ftvid = NULL)
Loads a test_entity.
Parameters
$ftid The id of the entity to load.
$ftvid (Optional) The revision id of the entity to load. If not specified, the current revision will be used.
Return value
The loaded entity.
Code
modules/field/tests/field_test.entity.inc, line 153
<?php
function field_test_entity_test_load($ftid, $ftvid = NULL) {
// Load basic strucure.
$query = db_select('test_entity', 'fte', array())
->fields('fte')
->condition('ftid', $ftid);
if ($ftvid) {
$query->condition('ftvid', $ftvid);
}
$entities = $query->execute()->fetchAllAssoc('ftid');
// Attach fields.
if ($ftvid) {
field_attach_load_revision('test_entity', $entities);
}
else {
field_attach_load('test_entity', $entities);
}
return $entities[$ftid];
}
?>Login or register to post comments 