You are here

function pmissue_update_7300 in Drupal PM (Project Management) 7.3

Same name and namespace in other branches
  1. 8 pmissue/pmissue.install \pmissue_update_7300()

Add entityreference_prepopulate behaviour to pmissue fields.

Fields altered pmissue_parent & pmissue_parent_issue.

File

pmissue/pmissue.install, line 55
Install, disable, uninstall and update functions for PM Issue module.

Code

function pmissue_update_7300() {
  $entity_type = 'node';
  $field_name = 'pmissue_parent';
  $bundle_name = 'pmissue';

  // Get defaults from the configurations.
  module_load_include('inc', 'pmissue', 'includes/pmissue.field_instance');
  $field_instances = pmissue_default_field_instances();
  $field_instance = $field_instances['node-pmissue-pmissue_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);
  $field_name = 'pmissue_parent_issue';
  $field_instance = $field_instances['node-pmissue-pmissue_parent_issue'];
  $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);
}