function field_tools_info_instances in Field tools 7
Helper to get a list of all instances of a field.
Parameters
$field_name: The name of a field.
Return value
An array of entity types and bundles this field has instances on. Keys are entity types, values are arrays of bundle names.
1 call to field_tools_info_instances()
- field_tools_field_page in ./
field_tools.admin.inc - Page callback to list all instances of a field with links to edit them.
File
- ./
field_tools.module, line 257 - field_tools.module Contains useful tools for working with fields.
Code
function field_tools_info_instances($field_name) {
$instances = field_info_instances();
$field_bundles = array();
foreach ($instances as $entity_type => $bundles) {
foreach ($bundles as $bundle => $bundle_instances) {
if (isset($bundle_instances[$field_name])) {
$field_bundles[$entity_type][] = $bundle;
}
}
}
return $field_bundles;
}