pmexpense.install in Drupal PM (Project Management) 7.2
Same filename and directory in other branches
Installation file for pmexpense module.
File
pmexpense/pmexpense.installView source
<?php
/**
* @file
* Installation file for pmexpense module.
*/
/**
* Implements hook_install().
*/
function pmexpense_install() {
variable_set('node_options_pmexpense', array(
'status',
));
// PM Permissions default configurations.
variable_set('pmpermission_field_parent_reference_for_pmexpense', 'pmexpense_parent');
variable_set('pmpermission_node_pmexpense_enabled', TRUE);
// Create and attaches fields to pmexpense content type.
module_load_include('inc', 'pmexpense', 'includes/pmexpense.migrate');
// Parameter $sandbox is passed as a placeholder.
$sandbox = array();
pmexpense_migrate_create_fields($sandbox);
}
/**
* Implements hook_uninstall().
*/
function pmexpense_uninstall() {
variable_del('pmpermission_field_parent_reference_for_pmexpense');
variable_del('pmpermission_node_pmexpense_enabled');
// Clean up field instances (and field) and its data.
module_load_include('inc', 'pmexpense', 'includes/pmexpense.field_instance');
module_load_include('inc', 'pmexpense', 'includes/pmexpense.field_base');
$declared_field_bases = pmexpense_default_field_bases();
$declared_field_instances = pmexpense_default_field_instances();
$field_instance = field_info_instances('node', 'pmexpense');
foreach ($declared_field_instances as $declared_instance) {
$instance = $field_instance[$declared_instance['field_name']];
if ($instance) {
// Only delete field base if declared by this module.
$delete_field_base = isset($declared_field_bases[$declared_instance['field_name']]);
field_delete_instance($instance, $delete_field_base);
}
}
}
/**
* Implements hook_update_last_removed().
*/
function pmexpense_update_last_removed() {
return 7104;
}
/**
* Migrate PM Expense nodes to field_api fields.
*/
function pmexpense_update_7200(&$sandbox) {
module_load_include('inc', 'pmexpense', 'includes/pmexpense.migrate');
if (pmexpense_migrate_update_could_be_performed()) {
return pmexpense_migrate($sandbox);
}
}
Functions
Name | Description |
---|---|
pmexpense_install | Implements hook_install(). |
pmexpense_uninstall | Implements hook_uninstall(). |
pmexpense_update_7200 | Migrate PM Expense nodes to field_api fields. |
pmexpense_update_last_removed | Implements hook_update_last_removed(). |