function _field_tools_entity_can_attach_field in Field tools 7
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.
2 calls to _field_tools_entity_can_attach_field()
- field_tools_bundle_fields_clone_to_form in ./
field_tools.admin.inc - Form builder for the cloning multiple fields to a bundle.
- _field_tools_add_instance_to_bundles in ./
field_tools.admin.inc - Helper function to clone a single field instance into multiple bundles.
File
- ./
field_tools.module, line 283 - field_tools.module Contains useful tools for working with fields.
Code
function _field_tools_entity_can_attach_field($entity_type, $field_info) {
return !(!empty($field_info['entity_types']) && !in_array($entity_type, $field_info['entity_types']));
}