You are here

function recipe_mastercook4_export_single in Recipe 7.2

Same name and namespace in other branches
  1. 6 plugins/recipe_mastercook4.module \recipe_mastercook4_export_single()
  2. 7 includes/recipe_mastercook4.module \recipe_mastercook4_export_single()
1 call to recipe_mastercook4_export_single()
recipe_mastercook4_export_multi in modules/recipe_mastercook4.module
1 string reference to 'recipe_mastercook4_export_single'
recipe_mastercook4_recipeio in modules/recipe_mastercook4.module
Implements hook_recipeio().

File

modules/recipe_mastercook4.module, line 53
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);

  // 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);
}