function recipe_mastercook4_export_single in Recipe 7
Same name and namespace in other branches
- 6 plugins/recipe_mastercook4.module \recipe_mastercook4_export_single()
- 7.2 modules/recipe_mastercook4.module \recipe_mastercook4_export_single()
1 call to recipe_mastercook4_export_single()
1 string reference to 'recipe_mastercook4_export_single'
- recipe_mastercook4_recipeio in includes/
recipe_mastercook4.module - Implementation of hook_recipeio($type).
File
- includes/
recipe_mastercook4.module, line 55 - recipe_mastercook4.module - Enables importing and exporting of MasterCook4 format recipes.
Code
function recipe_mastercook4_export_single($nid = NULL, $yield = NULL) {
if ($nid === NULL) {
drupal_set_message(t('Recipe not found.'));
drupal_not_found();
return;
}
$node = node_load($nid);
recipe_mastercook4_textify($node);
// you should not be able to export unpublished recipes
if ($node->status == 0) {
drupal_access_denied();
return;
}
// Set the custom yield so we can scale up/down the recipe quantities.
$node->recipe_custom_yield = $yield;
drupal_add_http_header('Content-type', 'text/plain; charset=utf-8');
return merge_template($node);
}