You are here

function recipe_node_prepare in Recipe 5

Same name and namespace in other branches
  1. 6 recipe.module \recipe_node_prepare()
  2. 7 recipe.module \recipe_node_prepare()

Custom version of node_prepare().

2 calls to recipe_node_prepare()
recipe_export_html in ./recipe.module
This function is called by recipe_export() to generate HTML for export.
recipe_view in ./recipe.module
Implementation of hook_view().

File

./recipe.module, line 1210
recipe.module - share recipes for drupal 5.x

Code

function recipe_node_prepare($node, $teaser = FALSE) {
  $node->readmore = TRUE;
  if ($teaser == FALSE) {
    $node->body = check_markup($node->body, $node->format, FALSE);
    $node->instructions = check_markup($node->instructions, $node->format, FALSE);
    if ($node->notes) {
      $node->notes = check_markup($node->notes, $node->format, FALSE);
    }
    if ($node->source) {
      $node->source = check_markup($node->source, $node->format, FALSE);
    }
    if ($node->ingredients) {
      $tmp = $node->ingredients;
      $node->ingredients = array();
      foreach ($tmp as $ingredient) {

        // For preview, node->ingredients is an array, for actual display, it's an object
        if (is_array($ingredient)) {
          if (isset($ingredient["name"])) {
            $ingredient["name"] = check_plain($ingredient["name"]);
          }
        }
        else {
          if (is_object($ingredient)) {
            if (isset($ingredient->name)) {
              $ingredient->name = check_plain($ingredient->name);
            }
          }
        }
        $node->ingredients[] = $ingredient;
      }
    }
  }
  else {
    $node->teaser = check_markup($node->body, $node->format, FALSE);
  }
  return $node;
}