You are here

function uuid_file_entity_features_export in UUID Features Integration 7

Implements hook_features_export().

File

includes/uuid_file_entity.features.inc, line 40
Features hooks for the uuid_file_entity features component.

Code

function uuid_file_entity_features_export($data, &$export, $module_name = '') {
  $pipe = array();
  $export['dependencies']['uuid_features'] = 'uuid_features';
  $fids = entity_get_id_by_uuid('file', $data);
  foreach ($fids as $uuid => $fid) {

    // Load the existing file, with a fresh cache.
    $file = file_load($fid, NULL, TRUE);
    $export['features']['uuid_file_entity'][$uuid] = $uuid;
    $pipe['file'][$file->type] = $file->type;

    // drupal_alter() normally supports just one byref parameter. Using
    // the __drupal_alter_by_ref key, we can store any additional parameters
    // that need to be altered, and they'll be split out into additional params
    // for the hook_*_alter() implementations.
    $data =& $export;
    $data['__drupal_alter_by_ref']['pipe'] =& $pipe;
    $entity_type = 'file';
    drupal_alter('uuid_entity_features_export', $entity_type, $data, $file, $module);
    drupal_alter('uuid_file_entity_features_export', $data, $file, $module);
    unset($data['__drupal_alter_by_ref']);
  }
  return $pipe;
}