You are here

function entity_embed_filter_fields_with_text_filtering in Entity Embed 7.2

Same name and namespace in other branches
  1. 7 includes/entity_embed.file_usage.inc \entity_embed_filter_fields_with_text_filtering()

Retrieve a list of fields attached to an entity with text processing support.

Parameters

$entity: The entity whose fields are being examined.

$entity_type: The type of the entity whose fields are being examined.

Return value

An array of the field names which support text processing.

1 call to entity_embed_filter_fields_with_text_filtering()
entity_embed_filter_parse_from_fields in includes/entity_embed.file_usage.inc
Parse file references from an entity's text fields.

File

includes/entity_embed.file_usage.inc, line 200
Tracks usage of embedded files.

Code

function entity_embed_filter_fields_with_text_filtering($entity_type, $entity) {
  list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);

  // Find all of the field instances attached to the entity.
  $field_instances = field_info_instances($entity_type, $bundle);
  $fields_with_text_processing = array();

  // Loop through the field instances and build a list of the ones which support
  // text processing.
  foreach ($field_instances as $field_name => $field) {
    if (!empty($field['settings']['text_processing'])) {
      $fields_with_text_processing[] = $field_name;
    }
  }
  return $fields_with_text_processing;
}