function pmtask_pm_contextual_links in Drupal PM (Project Management) 8
Same name and namespace in other branches
- 7.3 pmtask/pmtask.module \pmtask_pm_contextual_links()
Implements hook_pm_contextual_links().
File
- pmtask/
pmtask.module, line 78 - Hook implementations for PM Task.
Code
function pmtask_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('pmtask_parent');
$target_bundles = $field_info['settings']['handler_settings']['target_bundles'];
if (in_array($bundle, $target_bundles)) {
$links[t('Add Task')] = array(
'title' => t('Add Task'),
'href' => 'node/add/pmtask',
'query' => array(
'pmtask_parent' => $id,
),
);
}
}
return $links;
}