function _file_entity_get_fields_by_type in File Entity (fieldable files) 7.2
Same name and namespace in other branches
- 7.3 file_entity.module \_file_entity_get_fields_by_type()
Find all fields that are of a certain field type.
Parameters
string $field_type: A field type.
Return value
array An array of field names that match the type $field_type.
2 calls to _file_entity_get_fields_by_type()
- file_entity_field_attach_load in ./
file_entity.module - Implements hook_field_attach_load().
- _file_entity_update_image_field_dimensions in ./
file_entity.file.inc - Update the image dimensions stored in any image fields for a file.
File
- ./
file_entity.module, line 2662 - Extends Drupal file entities to be fieldable and viewable.
Code
function _file_entity_get_fields_by_type($field_type) {
$return = array();
if (function_exists('field_info_field_map')) {
foreach (field_info_field_map() as $field_name => $field) {
if ($field['type'] == $field_type) {
$return[$field_name] = $field_name;
}
}
}
else {
foreach (field_info_fields() as $field_name => $field) {
if ($field['type'] == $field_type) {
$return[$field_name] = $field_name;
}
}
}
return $return;
}