function eck__entity__build in Entity Construction Kit (ECK) 7.2
Same name and namespace in other branches
- 7.3 eck.entity.inc \eck__entity__build()
- 7 eck.entity.inc \eck__entity__build()
Get the entities view.
Parameters
string $entity_type: entity type
string $bundle: Bundle.
mixed $id: The entity id or the entity object itself Normally you wouldn't need to call this function if you already have the loaded entity but there are some workflows where an object is passed. So this function handles that case as well.
string $view_mode: View mode
1 call to eck__entity__build()
- eck__entity__view_callback in ./
eck.entity.inc - Entity view callback.
File
- ./
eck.entity.inc, line 274 - All the menus, pages, and functionality related to administering entities.
Code
function eck__entity__build($entity_type, $bundle, $id, $view_mode = "full") {
if (is_object($id) && $id
->entityType() == $entity_type->name && $id
->bundle() == $bundle->name) {
return $id
->view($view_mode);
}
elseif (is_numeric($id)) {
$entity = entity_load_single($entity_type->name, $id);
return $entity
->view($view_mode);
}
drupal_not_found();
drupal_exit();
}