function D7_field_tools_entity_can_attach_field in Field tools 8
Helper function to determine whether a field can be attached an entity type.
Certain fields like comment_body are restricted to certain entity types.
Parameters
string $entity_type: The entity type to check.
array $field_info: The field info to check.
Return value
boolean Whether the field can be attached to the entity type.
File
- ./
field_tools.module, line 317 - field_tools.module Contains useful tools for working with fields.
Code
function D7_field_tools_entity_can_attach_field($entity_type, $field_info) {
return !(!empty($field_info['entity_types']) && !in_array($entity_type, $field_info['entity_types']));
}