function entity_load_multiple_by_name in Entity API 7
A wrapper around entity_load() to return entities keyed by name key if existing.
Parameters
$entity_type: The entity type to load, e.g. node or user.
$names: An array of entity names or ids, or FALSE to load all entities.
$conditions: (deprecated) An associative array of conditions on the base table, where the keys are the database fields and the values are the values those fields must have. Instead, it is preferable to use EntityFieldQuery to retrieve a list of entity IDs loadable by this function.
Return value
array An array of entity objects indexed by their names (or ids if the entity type has no name key).
See also
9 calls to entity_load_multiple_by_name()
- EntityAPITestCase::testChanges in ./
entity.test - Tests determining changes.
- 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.
- EntityDefaultFeaturesController::export in ./
entity.features.inc - Generates the result for hook_features_export().
- EntityDefaultFeaturesController::export_options in ./
entity.features.inc - Generates the result for hook_features_export_options().
File
- ./
entity.module, line 262
Code
function entity_load_multiple_by_name($entity_type, $names = FALSE, $conditions = array()) {
$entities = entity_load($entity_type, $names, $conditions);
$info = entity_get_info($entity_type);
if (!isset($info['entity keys']['name'])) {
return $entities;
}
return entity_key_array_by_property($entities, $info['entity keys']['name']);
}