You are here

function format_mastercook4_ingredient in Recipe 6

Same name and namespace in other branches
  1. 7 includes/recipe_mastercook4.module \format_mastercook4_ingredient()
1 call to format_mastercook4_ingredient()
merge_template in plugins/recipe_mastercook4.module

File

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

Code

function format_mastercook4_ingredient($ingredient = NULL) {
  $ingredient['quantity'] = recipe_ingredient_quantity_from_decimal($ingredient['quantity'], TRUE);

  // no html entities
  $ingredient['quantity'] = str_replace('⁄', '/', $ingredient['quantity']);
  $ingredient['unit_name'] = recipe_unit_name($ingredient['unit_id']);
  $fullingredient = strlen($ingredient['note']) > 0 ? $ingredient['name'] . ' -- ' . $ingredient['note'] : $ingredient['name'];
  $fullingredient = strip_html_and_encode_entities($fullingredient);
  $fullingredient = wordwrap($fullingredient, 66, "\n                        ");
  $o = sprintf("%8s  %-12s  %s\n", $ingredient['quantity'], $ingredient['unit_name'], $fullingredient);
  return $o;
}