You are here

function theme_recipe_ingredient in Recipe 7.2

Returns HTML for displaying an ingredient field item.

1 theme call to theme_recipe_ingredient()
recipe_field_formatter_view in ./recipe.module
Implements hook_field_formatter_view().

File

./recipe.module, line 910
Contains functions for Recipe node CRUD and display.

Code

function theme_recipe_ingredient($variables) {
  $quantity = $variables['quantity'];
  $name = $variables['name'];
  $link = $variables['link'];
  $unit = $variables['unit'];
  $note = $variables['note'];

  // Display the name as a link if the link (ingredient node nid) is set.
  if (!empty($link)) {
    $name = l($name, 'node/' . $link);
  }

  // Concatenate the ingredient note to the name, if set.
  if (!empty($note)) {
    $name .= ' (' . $note . ')';
  }
  $output = '<span class="quantity-unit" property="schema:amount"> ' . $quantity . ' ' . $unit . '</span> <span class="ingredient-name" property="schema:name">' . $name . '</span>';
  return $output;
}