function pm_entity_view in Drupal PM (Project Management) 7.3
Same name and namespace in other branches
- 8 pm.module \pm_entity_view()
Implements hook_entity_view().
File
- ./
pm.module, line 232 - Main module file for the Project Management module.
Code
function pm_entity_view($entity, $type, $view_mode, $langcode) {
list($id, $vid, $bundle) = entity_extract_ids($type, $entity);
$extrafields = field_extra_fields_get_display($type, $bundle, $view_mode);
if (isset($extrafields[PM_CONTEXTUAL_LINK_PSEUDO_FIELD]) && isset($extrafields[PM_CONTEXTUAL_LINK_PSEUDO_FIELD]['visible']) && $extrafields[PM_CONTEXTUAL_LINK_PSEUDO_FIELD]['visible']) {
$links = module_invoke_all('pm_contextual_links', $entity, $type, $view_mode, $langcode);
ksort($links);
if (!empty($links)) {
$entity->content[PM_CONTEXTUAL_LINK_PSEUDO_FIELD] = array(
'#theme' => 'links__ctools_dropbutton',
'#links' => $links,
);
}
else {
$entity->content[PM_CONTEXTUAL_LINK_PSEUDO_FIELD] = '';
}
}
}