You are here

function mvf_field_delete_instance in Measured Value Field 7

Implements hook_field_delete_instance().

File

./mvf.module, line 1096
Define a field type of measured value.

Code

function mvf_field_delete_instance($instance) {
  $field = field_read_fields(array(
    'field_name' => $instance['field_name'],
  ), array(
    'include_deleted' => TRUE,
  ));
  $field = reset($field);
  if (in_array($field['type'], mvf_field_types())) {
    $measure = mvf_measure_extract($field);
    $view_modes = array_keys($instance['display']);
    $view_modes[] = NULL;
    foreach ($view_modes as $view_mode) {
      $unit_suggesters = mvf_unit_suggesters_info($field, $instance, $view_mode);
      foreach ($unit_suggesters as $unit_suggester) {
        if ($unit_suggester['settings']['enable']) {
          $function = ctools_plugin_get_function($unit_suggester['plugin'], 'disabled callback');
          if ($function) {
            $function($measure, $field, $instance, $view_mode, $unit_suggester['settings'], $unit_suggester['plugin']);
          }
        }
      }
    }
  }
}