1 field_ui.module field_ui_inactive_instances($entity_type, $bundle_name = NULL)

Identifies inactive fields within a bundle.

File

core/modules/field_ui/field_ui.module, line 372
Allows administrators to attach custom fields to fieldable types.

Code

function field_ui_inactive_instances($entity_type, $bundle_name = NULL) {
  if (!empty($bundle_name)) {
    $inactive = array($bundle_name => array());
    $params = array('bundle' => $bundle_name);
  }
  else {
    $inactive = array();
    $params = array();
  }
  $params['entity_type'] = $entity_type;

  $active_instances = field_info_instances($entity_type);
  $all_instances = field_read_instances($params, array('include_inactive' => TRUE));
  foreach ($all_instances as $instance) {
    if (!isset($active_instances[$instance['bundle']][$instance['field_name']])) {
      $inactive[$instance['bundle']][$instance['field_name']] = $instance;
    }
  }
  if (!empty($bundle_name)) {
    return $inactive[$bundle_name];
  }
  return $inactive;
}