function eck_entity_view_alter in Entity Construction Kit (ECK) 7.3
Same name and namespace in other branches
- 8 eck.module \eck_entity_view_alter()
- 7.2 eck.module \eck_entity_view_alter()
Implements hook_entity_view_alter().
File
- ./
eck.module, line 1050
Code
function eck_entity_view_alter(&$build) {
$entity_types = EntityType::loadAll();
$this_entity_type = $build['#entity_type'];
foreach ($entity_types as $et) {
if ($et->name == $this_entity_type) {
$entity = $build['#entity'];
$this_bundle = $entity
->bundle();
// Lets add contextual links to our entities in eck you can change
// the paths of any of the possible operations, since contextual links
// are dependent on the hierarchy of those paths, changing the paths
// could cause of contextual links not to work correctly.
$build['#contextual_links']['eck'] = array(
"{$this_entity_type}/{$this_bundle}",
array(
$entity->id,
),
);
}
}
}