pmnote.install in Drupal PM (Project Management) 7.3
Same filename and directory in other branches
Functions for the PM Note module.
File
pmnote/pmnote.installView source
<?php
/**
* @file
* Functions for the PM Note module.
*/
/**
* Implements hook_install().
*/
function pmnote_install() {
variable_set('node_options_pmnote', array(
'status',
));
// PM Permissions default configurations.
variable_set('pm_permission_field_parent_reference_for_pmnote', 'pmnote_parent');
variable_set('pm_permission_node_pmnote_enabled', TRUE);
// Create and attaches fields to pmnote content type.
module_load_include('inc', 'pmnote', 'includes/pmnote.migrate');
// Parameter $sandbox is passed as a placeholder.
$sandbox = array();
pmnote_migrate_create_fields($sandbox);
}
/**
* Implements hook_disable().
*/
function pmnote_disable() {
module_load_include('inc', 'pm', 'includes/pm.install');
$module = 'pmnote';
// Set standardised message.
pm_disable_message($module, 'notes');
}
/**
* Implements hook_uninstall().
*/
function pmnote_uninstall() {
module_load_include('inc', 'pm', 'includes/pm.install');
$module = 'pmnote';
// Delete items created by his module.
pm_uninstall_variables($module);
pm_uninstall_fields($module);
// Set standardised message.
pm_uninstall_message($module, 'notes');
}
/**
* Implements hook_update_last_removed().
*/
function pmnote_update_last_removed() {
return 6201;
}
/**
* Migrate PM Note nodes to field_api fields.
*/
function pmnote_update_7104(&$sandbox) {
module_load_include('inc', 'pmnote', 'includes/pmnote.migrate');
if (pmnote_migrate_update_could_be_performed()) {
return pmnote_migrate($sandbox);
}
}
/**
* Add entityreference_prepopulate behaviour to pmnote_parent.
*/
function pmnote_update_7300() {
$entity_type = 'node';
$field_name = 'pmnote_parent';
$bundle_name = 'pmnote';
// Get defaults from the configurations.
module_load_include('inc', 'pmnote', 'includes/pmnote.field_instance');
$field_instances = pmnote_default_field_instances();
$field_instance = $field_instances['node-pmnote-pmnote_parent'];
$instance_info = field_info_instance($entity_type, $field_name, $bundle_name);
$instance_info['settings']['behaviors']['prepopulate'] = $field_instance['settings']['behaviors']['prepopulate'];
$instance_info['default_value_function'] = $field_instance['default_value_function'];
field_update_instance($instance_info);
}
/**
* Implements hook_update_dependencies().
*/
function pmnote_update_dependencies() {
// pmperson_update_7104() migrates pmperson data to drupal user.
// pmnote migration depends on its completion.
$dependencies['pmnote'][7103] = array(
'pmperson' => 7104,
);
return $dependencies;
}
Functions
Name | Description |
---|---|
pmnote_disable | Implements hook_disable(). |
pmnote_install | Implements hook_install(). |
pmnote_uninstall | Implements hook_uninstall(). |
pmnote_update_7104 | Migrate PM Note nodes to field_api fields. |
pmnote_update_7300 | Add entityreference_prepopulate behaviour to pmnote_parent. |
pmnote_update_dependencies | Implements hook_update_dependencies(). |
pmnote_update_last_removed | Implements hook_update_last_removed(). |