You are here

function pmorganization_update_7302 in Drupal PM (Project Management) 8

Same name and namespace in other branches
  1. 7.3 pmorganization/pmorganization.install \pmorganization_update_7302()

Use pm_entity_reference_user_filter for pmorganization_members.

File

pmorganization/pmorganization.install, line 178
PM Organization install file.

Code

function pmorganization_update_7302() {
  $entity_type = 'node';
  $field_name = 'pmorganization_members';
  $bundle_name = 'pmorganization';

  // Get defaults from the configurations.
  // Update Field Base.
  module_load_include('inc', 'pmorganization', 'includes/pmorganization.field_base');
  $field_bases = pmorganization_default_field_bases();
  $field_base = $field_bases[$field_name];
  $base_info = array(
    'field_name' => $field_name,
    'settings' => $field_base['settings'],
  );
  field_update_field($base_info);

  // Update Field Instance.
  module_load_include('inc', 'pmorganization', 'includes/pmorganization.field_instance');
  $field_instances = pmorganization_default_field_instances();
  $field_instance = $field_instances['node-pmorganization-pmorganization_members'];
  $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);
}