You are here

entity_share_field_collection.module in Entity Share 7

Entity Share Field Collection .module file.

File

modules/entity_share_field_collection/entity_share_field_collection.module
View source
<?php

/**
 * @file
 * Entity Share Field Collection .module file.
 */

/**
 * Implements hook_es_export_field_data_alter().
 */
function entity_share_field_collection_es_export_field_data_alter(&$field_data, $context) {
  $field_name = $context['field_name'];
  $field_type = $context['field_type'];
  $entity = $context['entity'];
  $field_info = $context['field_info'];
  $lang = $context['lang'];
  $delta = $context['delta'];
  $entity_share_entity = $context['entity_share_entity'];

  // Alter the field_data.
  $esfc = new EntityShareFieldCollectionExport($field_data, $field_name, $field_type, $entity, $field_info, $lang, $delta, $entity_share_entity);
  $esfc
    ->exportDatas();
}

/**
 * Implements hook_es_import_field_data_before_alter().
 */
function entity_share_field_collection_es_import_field_data_alter(&$field_data, $context) {
  $field_name = $context['field_name'];
  $field_type = $context['field_type'];
  $entity = $context['entity'];
  $field_info = $context['field_info'];
  $lang = $context['lang'];
  $delta = $context['delta'];
  $entity_share_entity = $context['entity_share_entity'];

  // Import the field collection and alter the field_data.
  $esfc = new EntityShareFieldCollectionImport($field_data, $field_name, $field_type, $entity, $field_info, $lang, $delta, $entity_share_entity);
  $esfc
    ->importDatas();
}