You are here

function eck_entity_type_features_export_render in Entity Construction Kit (ECK) 7.3

Same name and namespace in other branches
  1. 7 eck.features.inc \eck_entity_type_features_export_render()
  2. 7.2 eck.features.inc \eck_entity_type_features_export_render()

Implements hook_features_export_render().

File

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

Code

function eck_entity_type_features_export_render($module, $data, $export = NULL) {

  // I am guessing that using FALSE and TRUE to initialize the array is
  // arbritrary, rigth?
  $elements = array(
    'name' => FALSE,
    'label' => TRUE,
    'properties' => FALSE,
  );
  $output = array();
  $output[] = '  $items = array(';
  foreach ($data as $entity_type_name) {
    $entity_type = EntityType::loadByName($entity_type_name);
    $elements['name'] = $entity_type->name;
    $elements['label'] = $entity_type->label;
    $elements['properties'] = $entity_type->properties;
    $output[] = '    ' . "'{$entity_type->name}' => " . features_var_export($elements, '    ') . ",";
  }
  $output[] = '  );';
  $output[] = '  return $items;';
  return array(
    'eck_entity_type_info' => implode("\n", $output),
  );
}