You are here

function eck__entity__view in Entity Construction Kit (ECK) 7.3

Same name and namespace in other branches
  1. 7 eck.entity.inc \eck__entity__view()
  2. 7.2 eck.entity.inc \eck__entity__view()

Creates a renderable array to show an entity.

Parameters

string $entity_type_name: Entity type.

string $bundle_name: Bundle.

mixed $id: ID or Entity Object being viewed.

File

./eck.entity.inc, line 537
All the menus, pages, and functionality related to administering entities.

Code

function eck__entity__view($entity_type_name, $bundle_name, $id) {
  if (is_object($id) && $id
    ->bundle() == $bundle_name) {
    $entity = $id;
  }
  elseif (is_object($id) && $id
    ->bundle() != $bundle_name) {
    drupal_not_found();
    exit;
  }
  else {
    $entity = entity_load_single($entity_type_name, $id);
  }
  return entity_view($entity_type_name, array(
    $entity,
  ));
}