pmtask.module in Drupal PM (Project Management) 7.3
Same filename and directory in other branches
Hook implementations for PM Task.
File
pmtask/pmtask.moduleView source
<?php
/**
* @file
* Hook implementations for PM Task.
*/
/**
* Implements hook_help().
*/
function pmtask_help($path, $arg) {
$o = '';
switch ($path) {
case "admin/help#pmtask":
$o = '<p>' . t("Provides task support for Project Management") . '</p>';
break;
}
return $o;
}
/**
* Implements hook_permission().
*/
function pmtask_permission() {
$name = 'Project Management Task';
return array(
"Project Management Task: access" => array(
'title' => t('Access %type_name.', array(
'%type_name' => $name,
)),
'description' => t('Allows the user to see pages and blocks associated with the %type_name, but does not control specific item that is shown within them.', array(
'%type_name' => $name,
)),
),
);
}
/**
* Implements hook_node_info().
*/
function pmtask_node_info() {
return array(
'pmtask' => array(
'name' => t('Task'),
'base' => 'pmtask',
'description' => t('Use <em>tasks</em> for granular work plans that can be structured within <em>Project Management</em>.'),
'title_label' => t('Title'),
),
);
}
/**
* Implements hook_form().
*/
function pmtask_form($node, &$form_state) {
$breadcrumb = array(
array(
'text' => t('Tasks'),
'path' => 'pm/tasks',
),
);
pm_set_breadcrumb($breadcrumb);
return node_content_form($node, $form_state);
}
/**
* Implements hook_view().
*/
function pmtask_view($node, $view_mode) {
if ($view_mode == 'full' && node_is_page($node)) {
$breadcrumb = array(
array(
'text' => t('Tasks'),
'path' => 'pm/tasks',
),
);
pm_set_breadcrumb($breadcrumb);
}
return $node;
}
/**
* Implements hook_pm_contextual_links().
*/
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');
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 Task')] = array(
'title' => t('Add Task'),
'href' => 'node/add/pmtask',
'query' => array(
'pmtask_parent' => $id,
),
);
}
}
return $links;
}
/**
* Implements hook_views_api().
*/
function pmtask_views_api() {
return array(
'api' => 2,
'path' => drupal_get_path('module', 'pmtask'),
);
}
/**
* Implements hook_pm_dashboard_links().
*/
function pmtask_pm_dashboard_links($type) {
$links = array();
if ($type == 'page' || $type == 'block') {
$links[] = array(
'theme' => 'pm_dashboard_link',
'title' => t('Tasks'),
'icon' => 'pmtasks',
'path' => 'pm/tasks',
'params' => array(),
'node_type' => 'pmtask',
'add_type' => 'pmtask',
'map' => array(),
'weight' => 5,
);
}
return $links;
}
Functions
Name | Description |
---|---|
pmtask_form | Implements hook_form(). |
pmtask_help | Implements hook_help(). |
pmtask_node_info | Implements hook_node_info(). |
pmtask_permission | Implements hook_permission(). |
pmtask_pm_contextual_links | Implements hook_pm_contextual_links(). |
pmtask_pm_dashboard_links | Implements hook_pm_dashboard_links(). |
pmtask_view | Implements hook_view(). |
pmtask_views_api | Implements hook_views_api(). |