function entity_load_single in Entity API 7
A wrapper around entity_load() to load a single entity by name or numeric id.
@todo Re-name entity_load() to entity_load_multiple() in d8 core and this to entity_load().
Parameters
$entity_type: The entity type to load, e.g. node or user.
$id: The entity id, either the numeric id or the entity name. In case the entity type has specified a name key, both the numeric id and the name may be passed.
Return value
object|false The entity object, or FALSE.
See also
8 calls to entity_load_single()
- EntityAPITestCase::testExportableHooks in ./
entity.test - Make sure insert() and update() hooks for exportables are invoked.
- EntityAPITestCase::testExportables in ./
entity.test - Test loading entities defined in code.
- EntityMetadataIntegrationTestCase::testCRUDfunctions in ./
entity.test - Runs some generic tests on each entity.
- entity_entity_view_content_type_render in ctools/
content_types/ entity_view.inc - Implements hook_PLUGIN_content_type_render().
- entity_revision_is_default in ./
entity.module - Checks whether the given entity is the default revision.
File
- ./
entity.module, line 238
Code
function entity_load_single($entity_type, $id) {
$entities = entity_load($entity_type, array(
$id,
));
return reset($entities);
}