You are here

function recipe_mastercook4_export_single in Recipe 6

Same name and namespace in other branches
  1. 7.2 modules/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 plugins/recipe_mastercook4.module
1 string reference to 'recipe_mastercook4_export_single'
recipe_mastercook4_recipeio in plugins/recipe_mastercook4.module
Implementation of hook_recipeio($type).

File

plugins/recipe_mastercook4.module, line 55
recipe_mastercook4.module - Enables importing and exporting of MasterCook4 format recipes.

Code

function recipe_mastercook4_export_single($nid = NULL) {
  if ($nid === NULL) {
    drupal_set_message(t('Recipe not found.'));
    drupal_not_found();
  }
  $node = node_load(array(
    'nid' => $nid,
    'type' => 'recipe',
  ));

  // you should not be able to export unpublished recipes
  if ($node->status == 0) {
    drupal_access_denied();
    return;
  }
  drupal_set_header('Content-type: text');
  return merge_template($node);
}