pmteam.install in Drupal PM (Project Management) 7
Same filename and directory in other branches
Install, uninstall and update functions for Project Management Team
File
pmteam/pmteam.installView source
<?php
/**
* @file
* Install, uninstall and update functions for Project Management Team
*/
/**
* Implements hook_install().
*/
function pmteam_install() {
variable_set('node_options_pmteam', array(
'status',
));
variable_set('node_permissions_pmteam', 0);
// Uncache node types
node_types_rebuild();
// Fetch the list of current node types and add the body field to pmteam
$types = node_type_get_types();
node_add_body_field($types['pmteam'], 'Description');
}
/**
* Implements hook_enable().
*/
function pmteam_enable() {
node_access_needs_rebuild(TRUE);
}
/**
* Implements hook_disable().
*/
function pmteam_disable() {
node_access_needs_rebuild(TRUE);
drupal_set_message(t('Nodes of type "Team" have not been deleted on disabling Project Management Team. Please note that they will now have reduced functionality, and will not be protected by Project Management Team access controls.'), 'warning');
}
/**
* Implements hook_uninstall().
*/
function pmteam_uninstall() {
drupal_uninstall_schema('pmteam');
}
/**
* Implements hook_schema().
*/
function pmteam_schema() {
$schema['pmteam'] = array(
'fields' => array(
'vid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'nid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'mnid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'vid',
'nid',
'mnid',
),
'indexes' => array(
'vid' => array(
'vid',
),
'nid' => array(
'nid',
),
'mnid' => array(
'mnid',
),
),
);
return $schema;
}
/**
* Implements hook_update_last_removed().
*/
function pmteam_update_last_removed() {
return 6201;
}
/**
* Adds Drupal 7 style body field to Project Management Team nodes
*/
function pmteam_update_7100() {
// Uncache node types
node_types_rebuild();
// Fetch a list of current node types and add a body field to Project Management Team
$types = node_type_get_types();
node_add_body_field($types['pmteam'], 'Description');
}
/**
* Allow Project Management to override the default content type permissions
*/
function pmteam_update_7101() {
variable_set('node_permissions_pmteam', 0);
return 'PM Team permissions overridden';
}
/**
* Display message to admin regarding need to rebuild permission.
*/
function pmteam_update_7102() {
node_access_needs_rebuild(TRUE);
}
Functions
Name | Description |
---|---|
pmteam_disable | Implements hook_disable(). |
pmteam_enable | Implements hook_enable(). |
pmteam_install | Implements hook_install(). |
pmteam_schema | Implements hook_schema(). |
pmteam_uninstall | Implements hook_uninstall(). |
pmteam_update_7100 | Adds Drupal 7 style body field to Project Management Team nodes |
pmteam_update_7101 | Allow Project Management to override the default content type permissions |
pmteam_update_7102 | Display message to admin regarding need to rebuild permission. |
pmteam_update_last_removed | Implements hook_update_last_removed(). |