function pmtimetracking_install in Drupal PM (Project Management) 7
Same name and namespace in other branches
- 8 pmtimetracking/pmtimetracking.install \pmtimetracking_install()
- 7.3 pmtimetracking/pmtimetracking.install \pmtimetracking_install()
- 7.2 pmtimetracking/pmtimetracking.install \pmtimetracking_install()
Implements hook_install().
File
- pmtimetracking/
pmtimetracking.install, line 10 - Install functions for PM Timetracking.
Code
function pmtimetracking_install() {
variable_set('node_options_pmtimetracking', array(
'status',
));
variable_set('node_permissions_pmtimetracking', 0);
// Uncache node types
node_types_rebuild();
// Add instance of date field.
field_create_instance(array(
'field_name' => 'pm_date',
'label' => 'Date',
'widget' => array(
'weight' => '-18',
'type' => 'date_text',
'module' => 'date',
'active' => 1,
'settings' => array(
'input_format' => 'm/d/Y - H:i:s',
'input_format_custom' => '',
'year_range' => '-3:+3',
'increment' => 15,
'label_position' => 'above',
'text_parts' => array(),
),
),
'settings' => array(
'default_value' => 'now',
'default_value_code' => '',
'default_value2' => 'same',
'default_value_code2' => '',
'user_register_form' => FALSE,
),
'display' => array(
'default' => array(
'label' => 'above',
'type' => 'date_default',
'settings' => array(
'format_type' => 'long',
'multiple_number' => '',
'multiple_from' => '',
'multiple_to' => '',
'fromto' => 'both',
),
'module' => 'date',
'weight' => 1,
),
'teaser' => array(
'type' => 'hidden',
'label' => 'above',
'settings' => array(),
'weight' => 0,
),
),
'required' => 0,
'entity_type' => 'node',
'bundle' => 'pmtimetracking',
));
// Set up instance of billing status field.
field_create_instance(array(
'field_name' => 'pm_billing_status',
'label' => 'Billing status',
'entity_type' => 'node',
'bundle' => 'pmtimetracking',
'widget' => array(
'weight' => -17,
'type' => 'options_select',
'module' => 'options',
'active' => 1,
'settings' => array(),
),
'required' => 1,
'description' => '',
'default_value' => array(
array(
'value' => variable_get('pmtimetracking_billable_default', 0) ? 'Billable' : 'Not billable',
),
),
));
// Fetch list of current node types.
$types = node_type_get_types();
// Add body field to PM Timetracking content type.
node_add_body_field($types['pmtimetracking'], 'Description');
}