function uuid_features_set_uuid_references in UUID Features Integration 7
Walks through a list of fields and sets UUID property using entity ids.
Parameters
array $fields: Filtered array of fields of the same type.
string $entity_type: The entity type.
5 calls to uuid_features_set_uuid_references()
- commerce_product_reference_uuid_entity_features_export_render_alter in includes/
modules/ commerce_product_reference.inc - Implements hook_uuid_entity_features_export_render_alter().
- field_collection_uuid_entity_features_export_render_alter in includes/
modules/ field_collection.inc - Implements hook_uuid_entity_features_export_render_alter().
- paragraphs_uuid_entity_features_export_render_alter in includes/
modules/ paragraphs.inc - Implements hook_uuid_entity_features_export_render_alter().
- taxonomy_uuid_entity_features_export_render_alter in includes/
modules/ taxonomy.inc - Implements hook_uuid_entity_features_export_render_alter().
- _entity_reference_uuid_entity_features_export_set_uuid_references in includes/
modules/ entityreference.inc - Helper function to set uuid references in case of different fields types.
File
- ./
uuid_features.module, line 872 - UUID Features module allows to export data stored in the db by features.
Code
function uuid_features_set_uuid_references(&$fields, $entity_type) {
foreach ($fields as $field_name => &$field_languages) {
foreach ($field_languages as &$field_values) {
foreach ($field_values as &$field_value) {
$field_info = field_info_field($field_name);
$columns = array_keys($field_info['columns']);
$id_column = $columns[0];
$entities = entity_get_uuid_by_id($entity_type, array(
$field_value[$id_column],
));
$field_reference_uuid = reset($entities);
if ($field_reference_uuid) {
$field_value['uuid'] = $field_reference_uuid;
foreach ($columns as $column) {
$field_value[$column] = $field_reference_uuid;
}
}
}
}
}
}