public function EntityDefaultFeaturesController::export_render in Entity API 7
Generates the result for hook_features_export_render().
File
- ./
entity.features.inc, line 113 - Provides Features integration for entity types using the CRUD API.
Class
- EntityDefaultFeaturesController
- Default controller handling features integration.
Code
public function export_render($module, $data, $export = NULL) {
$output = array();
$output[] = ' $items = array();';
foreach (entity_load_multiple_by_name($this->type, $data) as $name => $entity) {
$export = " \$items['{$name}'] = entity_import('{$this->type}', '";
// Make sure to escape the characters \ and '.
$export .= addcslashes(entity_export($this->type, $entity, ' '), '\\\'');
$export .= "');";
$output[] = $export;
}
$output[] = ' return $items;';
$output = implode("\n", $output);
$hook = isset($this->info['export']['default hook']) ? $this->info['export']['default hook'] : 'default_' . $this->type;
return array(
$hook => $output,
);
}