You are here

function pmexpense_update_7300 in Drupal PM (Project Management) 8

Same name and namespace in other branches
  1. 7.3 pmexpense/pmexpense.install \pmexpense_update_7300()

Add entityreference_prepopulate behaviour to pmexpense_parent.

File

pmexpense/pmexpense.install, line 72
Installation file for pmexpense module.

Code

function pmexpense_update_7300() {
  $entity_type = 'node';
  $field_name = 'pmexpense_parent';
  $bundle_name = 'pmexpense';

  // Get defaults from the configurations.
  module_load_include('inc', 'pmexpense', 'includes/pmexpense.field_instance');
  $field_instances = pmexpense_default_field_instances();
  $field_instance = $field_instances['node-pmexpense-pmexpense_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);
}