entity_load_single

7 entity.module entity_load_single($entity_type, $id)

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

The entity object, or FALSE.

See also

entity_load()

47 calls to entity_load_single()

File

contributions/entity/entity.module, line 134
Module file for the entity API.

Code

function entity_load_single($entity_type, $id) {
  $entities = entity_load($entity_type, array($id));
  return reset($entities);
}