1 file.module | _file_get_fields_by_type($field_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.
File
- core/
modules/ file/ file.module, line 2678 - Defines a "managed_file" Form API field and a "file" field for Field module.
Code
function _file_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;
}