You are here

function resource_conflict_field_update_instance in Resource Conflict 7.3

Implements hook_field_update_instance().

Notice when an RC-enabled field is modified, and make sure it still meets requirements.

File

./resource_conflict.module, line 367
Provides general functionality for the resource conflict module.

Code

function resource_conflict_field_update_instance($instance, $prior_instance) {
  if (variable_get('rc_type_' . $instance['bundle'], FALSE) && variable_get('rc_date_field_' . $instance['bundle'], FALSE) == $instance['field_name']) {
    if (!_resource_conflict_check_field_compatibility($instance)) {
      variable_del('rc_date_field_' . $instance['bundle']);
      _resource_conflict_remove_type($instance['bundle']);
      $msg = t('Resource Conflict has been disabled for the %type content type as the date field no longer meets requirements', array(
        '%type' => $instance['bundle'],
      ));
      drupal_set_message($msg, 'warning');
      watchdog('resource conflict', $msg, WATCHDOG_WARNING);
    }
  }
}