function pmticket_pm_contextual_links in Drupal PM (Project Management) 7.3
Same name and namespace in other branches
- 8 pmticket/pmticket.module \pmticket_pm_contextual_links()
Implements hook_pm_contextual_links().
File
- pmticket/
pmticket.module, line 83 - Main module file for the PM Ticket module.
Code
function pmticket_pm_contextual_links($entity, $type, $view_mode, $langcode) {
$links = array();
list($id, $vid, $bundle) = entity_extract_ids($type, $entity);
if ($type == 'node') {
$field_info = field_info_field('pmticket_parent');
if (isset($field_info['settings']['handler_settings']['target_bundles'])) {
$target_bundles = $field_info['settings']['handler_settings']['target_bundles'];
}
else {
$target_bundles = array(
'pmproject',
);
}
if (in_array($bundle, $target_bundles)) {
$links[t('Add Ticket')] = array(
'title' => t('Add Ticket'),
'href' => 'node/add/pmticket',
'query' => array(
'pmticket_parent' => $id,
),
);
}
}
return $links;
}