You are here

function paragraphs_uuid_entity_features_export_alter in UUID Features Integration 7

Implements hook_uuid_entity_features_export_alter().

File

includes/modules/paragraphs.inc, line 29
uuid features hooks on behalf of the paragraphs module.

Code

function paragraphs_uuid_entity_features_export_alter($entity_type, &$data, $entity, $module) {
  $fields = uuid_features_get_field_items_iterator($entity, $entity_type, 'paragraphs');
  if (!empty($fields)) {
    $paragraphs_ids = array();
    foreach ($fields as $field) {
      foreach ($field as $lang_items) {
        foreach ($lang_items as $values) {
          $paragraphs_ids[] = $values['value'];
        }
      }
    }

    // Add dependencies to paragraphs items.
    $uuids = entity_get_uuid_by_id('paragraphs_item', $paragraphs_ids);
    foreach ($uuids as $uuid) {
      $data['features']['uuid_paragraphs'][$uuid] = $uuid;
    }
  }
}