You are here

function eck_entity_type_features_export_render in Entity Construction Kit (ECK) 7.2

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

Implements hook_features_export_render().

File

./eck.features.inc, line 48
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(';
  $entity_types = EntityType::loadMultipleByName($data);
  foreach ($entity_types as $entity_type) {
    $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),
  );
}