You are here

function eck_bundle_features_export_render in Entity Construction Kit (ECK) 7.2

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

Implements hook_features_export_render().

File

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

Code

function eck_bundle_features_export_render($module, $data, $export = NULL) {
  $elements = array(
    'machine_name' => NULL,
    'entity_type' => NULL,
    'name' => NULL,
    'label' => NULL,
    'config' => NULL,
  );
  $output = array();
  $output[] = '  $items = array(';
  $bundles = Bundle::loadMultipleByMachineName($data);
  foreach ($bundles as $bundle_machine_name => $bundle) {
    unset($bundle->id);
    foreach ($elements as $key => $value) {
      $elements[$key] = $bundle->{$key};
    }
    $output[] = "    '{$bundle->machine_name}' => " . features_var_export($elements, '    ') . ",";
  }
  $output[] = '  );';
  $output[] = '  return $items;';
  return array(
    'eck_bundle_info' => implode("\n", $output),
  );
}