function recipe_mastercook4_format_ingredient in Recipe 7.2
Formats an ingredient for display as a MasterCook4 recipe.
Parameters
string $name: The ingredient name.
string $quantity: The ingredient quantity.
string $unit: The units for the ingredient quantity.
string $note: The ingredient preparation note.
Return value
string The formatted ingredient.
1 call to recipe_mastercook4_format_ingredient()
- merge_template in modules/
recipe_mastercook4.module
File
- modules/
recipe_mastercook4.module, line 216 - Enables importing and exporting of MasterCook4 format recipes.
Code
function recipe_mastercook4_format_ingredient($name, $quantity = ' ', $unit = '', $note = '') {
// Concatenate the ingredient note to the name, if set.
if (!empty($note)) {
$name .= ' -- ' . $note;
}
$name = wordwrap($name, 66, "\n ");
$output = sprintf("%8s %-12s %s\n", $quantity, $unit, $name);
return $output;
}