You are here

function pmtask_update_7300 in Drupal PM (Project Management) 8

Same name and namespace in other branches
  1. 7.3 pmtask/pmtask.install \pmtask_update_7300()

Add entityreference_prepopulate behaviour to pmtask_parent.

File

pmtask/pmtask.install, line 76
Install, disable, uninstall and update functions for pmtask module.

Code

function pmtask_update_7300() {
  $entity_type = 'node';
  $field_name = 'pmtask_parent';
  $bundle_name = 'pmtask';

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