You are here

function prepare_receipe_data in Recipe 6

1 call to prepare_receipe_data()
recipe_pdf35_export_single in plugins/recipe_pdf35.module

File

plugins/recipe_pdf35.module, line 222
recipe_pdf35.module - Enables exporting of 3x5" cards in pdf format. This is incredibly rudimentary at this point. 1 and only 1 card and if you go over, the text is lost.

Code

function prepare_receipe_data($node) {

  // Preprocess the ingredients.
  $ingredients = array();
  foreach ($node->ingredients as $key => $i) {
    $fullingredient = strlen($i['note']) > 0 ? $i['name'] . ' (' . $i['note'] . ')' : $i['name'];
    $quantity = recipe_ingredient_quantity_from_decimal($i['quantity'], TRUE);
    $quantity = trim(str_replace('⁄', '/', $quantity));
    $ingredients[] = $quantity . ' ' . $i['abbreviation'] . ' ' . $fullingredient;
  }

  // Preprocess the instructions.
  $instructions_str = strip_html_and_encode_entities($node->instructions);
  $data = array(
    'recipe_title' => $node->title,
    'ingredient_heading' => t('Ingredients'),
    'instruction_heading' => t('Instructions'),
    'ingredients' => $ingredients,
    'instructions' => $instructions_str,
  );
  return $data;
}