You are here

function entity_object_load in Entity API 7

Menu loader function: load an entity from its path.

This can be used to load entities of all types in menu paths:


$items['myentity/%entity_object'] = array(
  'load arguments' => array('myentity'),
  'title' => ...,
  'page callback' => ...,
  'page arguments' => array(...),
  'access arguments' => array(...),
);

Parameters

$entity_id: The ID of the entity to load, passed by the menu URL.

$entity_type: The type of the entity to load.

Return value

object|false A fully loaded entity object, or FALSE in case of error.

File

./entity.module, line 110

Code

function entity_object_load($entity_id, $entity_type) {
  $entities = entity_load($entity_type, array(
    $entity_id,
  ));
  return reset($entities);
}