You are here

function recipe_insert in Recipe 7

Same name and namespace in other branches
  1. 5 recipe.module \recipe_insert()
  2. 6 recipe.module \recipe_insert()
  3. 7.2 recipe.module \recipe_insert()

Implements hook_insert().

Insert a new recipe into the database.

File

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

Code

function recipe_insert($node) {
  db_insert('recipe')
    ->fields(array(
    'nid' => $node->nid,
    'source' => $node->recipe_source,
    'yield' => $node->recipe_yield,
    'yield_unit' => $node->recipe_yield_unit,
    'description' => $node->recipe_description['value'],
    'instructions' => $node->recipe_instructions['value'],
    'notes' => $node->recipe_notes['value'],
    'preptime' => $node->recipe_preptime,
    'cooktime' => $node->recipe_cooktime,
  ))
    ->execute();
  recipe_save_ingredients($node);
}