You are here

function eck_bundle_features_export in Entity Construction Kit (ECK) 7.2

Same name and namespace in other branches
  1. 7.3 eck.features.inc \eck_bundle_features_export()

Implements hook_features_export().

File

./eck.features.inc, line 163
Integration with the Features module.

Code

function eck_bundle_features_export($data, &$export, $module_name = '') {
  $pipe = array();
  $bundles = Bundle::loadMultipleByMachineName($data);
  foreach ($bundles as $machine_name => $bundle) {

    // Export the entity type.
    $export['features']['eck_bundle'][$machine_name] = $machine_name;
    $export['dependencies']['eck'] = 'eck';
    $export['dependencies']['features'] = 'features';

    // Export fields.
    // @TODO: Features already supports this, just gotta find the right calls.
    $fields = field_info_instances($bundle->entity_type, $bundle->name);
    foreach ($fields as $field) {
      $pipe['field'][] = "{$bundle->entity_type}-{$field['bundle']}-{$field['field_name']}";
    }
  }
  return $pipe;
}