pmexpense.module in Drupal PM (Project Management) 7.2
Same filename and directory in other branches
Hook implementations and main functions for PM Expense.
File
pmexpense/pmexpense.moduleView source
<?php
/**
* @file
* Hook implementations and main functions for PM Expense.
*/
/**
* Implements hook_help().
*/
function pmexpense_help($path, $arg) {
$o = '';
switch ($path) {
case "admin/help#pmexpense":
$o = '<p>' . t("Provides expense support for Project Management") . '</p>';
break;
}
return $o;
}
/**
* Implements hook_permission().
*/
function pmexpense_permission() {
return array(
'Project Management expense: access' => array(
'title' => t('Access PM Expense'),
'description' => t('Allows the user to see pages and blocks associated with the PM Expense module, but does not control which expenses are shown within them.'),
),
);
}
/**
* Implements hook_node_info().
*/
function pmexpense_node_info() {
return array(
'pmexpense' => array(
'name' => t('Expense'),
'base' => 'pmexpense',
'description' => t('Use <em>expenses</em> for recording money spent and allocating to the relevant work within <em>Project Management</em>.'),
'title_label' => t('Title'),
),
);
}
/**
* Implements hook_pmexpense_form().
*/
function pmexpense_form($node, $form_state) {
$breadcrumb = array(
l(t('Project Management'), 'pm'),
l(t('Expenses'), 'pm/expenses'),
);
drupal_set_breadcrumb($breadcrumb);
return node_content_form($node, $form_state);
}
/**
* Implements hook_view().
*/
function pmexpense_view($node, $view_mode) {
if ($view_mode == 'full' && node_is_page($node)) {
$breadcrumb = array(
l(t('Project Management'), 'pm'),
l(t('Expenses'), 'pm/expenses'),
);
drupal_set_breadcrumb($breadcrumb);
}
return $node;
}
/**
* Implements hook_views_api().
*/
function pmexpense_views_api() {
return array(
'api' => 2,
'path' => drupal_get_path('module', 'pmexpense'),
);
}
/**
* Implements hook_pm_dashboard_links().
*/
function pmexpense_pm_dashboard_links($type) {
$links = array();
if ($type == 'page' || $type == 'block') {
$links[] = array(
'theme' => 'pm_dashboard_link',
'title' => t('Expenses'),
'icon' => 'pmexpenses',
'path' => 'pm/expenses',
'params' => array(),
'node_type' => 'pmexpense',
'add_type' => 'pmexpense',
'map' => array(),
'weight' => 11,
);
}
return $links;
}
Functions
Name | Description |
---|---|
pmexpense_form | Implements hook_pmexpense_form(). |
pmexpense_help | Implements hook_help(). |
pmexpense_node_info | Implements hook_node_info(). |
pmexpense_permission | Implements hook_permission(). |
pmexpense_pm_dashboard_links | Implements hook_pm_dashboard_links(). |
pmexpense_view | Implements hook_view(). |
pmexpense_views_api | Implements hook_views_api(). |