You are here

entity_share_medias.module in Entity Share 7

Entity Share Medias .module file.

File

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

/**
 * @file
 * Entity Share Medias .module file.
 */

/**
 * Implements hook_es_export_field_data_alter().
 */
function entity_share_medias_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'];

  // Alter the field_data.
  $esm = new EntityShareMedias($field_data, $field_name, $field_type, $entity, $field_info);
  $esm
    ->exportMedias();
}

/**
 * Implements hook_es_import_field_data_before_alter().
 */
function entity_share_medias_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'];

  // Import the medias and alter the field_data.
  $esm = new EntityShareMedias($field_data, $field_name, $field_type, $entity, $field_info);
  $esm
    ->importMedias();
}

Functions