1 field.info.inc | field_info_instances($entity_type = NULL, $bundle_name = NULL) |
Retrieves information about field instances.
Parameters
$entity_type: The entity type for which to return instances.
$bundle_name: The bundle name for which to return instances.
Return value
If $entity_type is not set, return all instances keyed by entity type and: bundle name. If $entity_type is set, return all instances for that entity type, keyed by bundle name. If $entity_type and $bundle_name are set, return all instances for that bundle.
Related topics
File
- core/
modules/ field/ field.info.inc, line 745 - Field Info API, providing information about available fields and field types.
Code
function field_info_instances($entity_type = NULL, $bundle_name = NULL) {
$info = _field_info_collate_fields();
if (isset($entity_type) && isset($bundle_name)) {
return isset($info['instances'][$entity_type][$bundle_name]) ? $info['instances'][$entity_type][$bundle_name] : array();
}
elseif (isset($entity_type)) {
return isset($info['instances'][$entity_type]) ? $info['instances'][$entity_type] : array();
}
else {
return $info['instances'];
}
}