function node_features_export_render in Features 7
Same name and namespace in other branches
- 6 includes/features.node.inc \node_features_export_render()
- 7.2 includes/features.node.inc \node_features_export_render()
Implements hook_features_export_render().
File
- includes/
features.node.inc, line 57
Code
function node_features_export_render($module, $data, $export = NULL) {
$elements = array(
'name' => TRUE,
'base' => FALSE,
'description' => TRUE,
'has_title' => FALSE,
'title_label' => TRUE,
'help' => TRUE,
);
$output = array();
$output[] = ' $items = array(';
foreach ($data as $type) {
if ($info = node_type_get_type($type)) {
// Force module name to be 'features' if set to 'node. If we leave as
// 'node' the content type will be assumed to be database-stored by
// the node module.
$info->base = $info->base === 'node' ? 'features' : $info->base;
$output[] = " '{$type}' => array(";
foreach ($elements as $key => $t) {
if ($t) {
$text = str_replace("'", "\\'", $info->{$key});
$text = !empty($text) ? "t('{$text}')" : "''";
$output[] = " '{$key}' => {$text},";
}
else {
$output[] = " '{$key}' => '{$info->{$key}}',";
}
}
$output[] = " ),";
}
}
$output[] = ' );';
$output[] = ' return $items;';
$output = implode("\n", $output);
return array(
'node_info' => $output,
);
}