You are here

function uuid_commerce_product_features_export in UUID Features Integration 7

Implements hook_features_export().

File

includes/uuid_commerce_product.features.inc, line 46
Features hooks for the uuid_commerce_product features component.

Code

function uuid_commerce_product_features_export($data, &$export, $module_name = '') {
  $pipe = array();
  $export['dependencies']['uuid_features'] = 'uuid_features';
  $product_ids = entity_get_id_by_uuid('commerce_product', $data);
  foreach ($product_ids as $uuid => $product_id) {

    // Load the existing commerce product, with a fresh cache.
    $product = commerce_product_load($product_id, NULL, TRUE);
    $export['features']['uuid_commerce_product'][$uuid] = $uuid;
    $pipe['commerce_product'][$product->type] = $product->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 = 'commerce_product';
    drupal_alter('uuid_entity_features_export', $entity_type, $data, $product, $module);
    drupal_alter('uuid_commerce_product_features_export', $data, $product, $module);
    unset($data['__drupal_alter_by_ref']);
  }
  return $pipe;
}