You are here

function minisite_asset_fields_info in Mini site 7

Finds all fields of a particular field type.

1 call to minisite_asset_fields_info()
minisite_asset_field_bundles_info in includes/minisite.func.inc
Return minisite information with bundled entities.

File

includes/minisite.func.inc, line 81
minisite.func.inc

Code

function minisite_asset_fields_info($field_type, $entity_type = NULL) {
  $fields = array();

  // Loop through the fields looking for any fields of the specified type.
  foreach (field_info_field_map() as $field_name => $field_stub) {
    if ($field_stub['type'] == $field_type) {

      // Add this field to the return array if no entity type was specified or
      // if the specified type exists in the field's bundles array.
      if (empty($entity_type) || in_array($entity_type, array_keys($field_stub['bundles']))) {
        $field = field_info_field($field_name);
        $fields[$field_name] = $field;
      }
    }
  }
  return $fields;
}