You are here

function entityreference_current_field_create_instance in Entityreference Current 7

Implements hook_field_create_instance().

Add "default value function" setting to the field instance. We have to do it from this hook, as we don't have another chance of setting this option via the hook_field_info().

File

./entityreference_current.module, line 24
Prepoplates entity reference values from Current Entity(Menu Object).

Code

function entityreference_current_field_create_instance($instance) {
  if (empty($instance['settings']['behaviors']['current']['status'])) {
    return;
  }
  $instance['default_value_function'] = 'entityreference_current_field_default_value';
  field_update_instance($instance);
}