function format_mastercook4_ingredient in Recipe 7
Same name and namespace in other branches
- 6 plugins/recipe_mastercook4.module \format_mastercook4_ingredient()
1 call to format_mastercook4_ingredient()
- merge_template in includes/
recipe_mastercook4.module
File
- includes/
recipe_mastercook4.module, line 179 - 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']);
$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['str_unit'], $fullingredient);
return $o;
}