You are here

function uuid_features_get_field_items_iterator in UUID Features Integration 7

Helper function to get a filtered list of fields of the same type.

Parameters

object $export: The entity object to export e.g. a node.

string $entity_type: The entity type.

string $field_type: The field type to look for e.g. 'field_collection', 'taxonomy_term_reference'.

Return value

array A filtered list of fields of the same type.

13 calls to uuid_features_get_field_items_iterator()
commerce_product_reference_uuid_entity_features_export_alter in includes/modules/commerce_product_reference.inc
Implements hook_uuid_entity_features_export_alter().
commerce_product_reference_uuid_entity_features_export_render_alter in includes/modules/commerce_product_reference.inc
Implements hook_uuid_entity_features_export_render_alter().
commerce_product_reference_uuid_entity_features_rebuild_alter in includes/modules/commerce_product_reference.inc
Implements hook_uuid_entity_features_rebuild_alter().
entityreference_uuid_entity_features_export_render_alter in includes/modules/entityreference.inc
Implements hook_uuid_entity_features_export_render_alter().
entityreference_uuid_entity_features_rebuild_alter in includes/modules/entityreference.inc
Implements hook_uuid_entity_features_rebuild_alter().

... See full list

File

./uuid_features.module, line 841
UUID Features module allows to export data stored in the db by features.

Code

function uuid_features_get_field_items_iterator(&$export, $entity_type, $field_type) {
  list($entity_id, $revision_id, $export_bundle) = entity_extract_ids($entity_type, $export);
  $fields = field_info_instances($entity_type, $export_bundle);
  if (!isset($export_bundle)) {
    $fields = reset($fields);
  }
  $return = array();
  foreach ($fields as $field_instance) {
    $info = field_info_field($field_instance['field_name']);
    if (isset($export->{$info['field_name']})) {
      $field =& $export->{$info['field_name']};
      if ($info['type'] == $field_type) {
        foreach ($field as $language => &$field_items) {
          $return[$field_instance['field_name']] = array(
            $language => &$field_items,
          );
        }
      }
    }
  }
  return $return;
}