function custom_pub_features_export_render in Custom Publishing Options 7
Implements hook_features_export_render().
File
- ./
custom_pub.features.inc, line 43 - Adds support for the Features module.
Code
function custom_pub_features_export_render($module, $data, $export = NULL) {
$pub_types = variable_get('custom_pub_types', array());
$pub_type_names = array_keys($pub_types);
$output = array();
$output[] = ' $options = array();';
foreach ($data as $option_name) {
if (in_array($option_name, $pub_type_names)) {
$option_node_types = $pub_types[$option_name]['node_types'];
$output[] = " // Exported option: {$option_name}";
$output[] = " \$options['{$option_name}'] = array(";
$output[] = " 'type' => '{$option_name}',";
$output[] = " 'name' => t('{$pub_types[$option_name]['name']}'),";
$output[] = " 'node_types' => array(";
foreach ($option_node_types as $node_type => $node_name) {
$output[] = " '{$node_type}' => t('{$node_name}'),";
}
$output[] = " ),";
$output[] = " );";
$output[] = "";
}
}
$output[] = ' return $options;';
$output = implode("\n", $output);
return array(
'custom_pub_defaults' => $output,
);
}