You are here

function recipe_clone_node_alter in Recipe 7

Implements hook_clone_node_alter().

Removes ingredient reference ID numbers from the node object so that the references will be cloned properly.

File

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

Code

function recipe_clone_node_alter($node, $context) {
  if ($context['method'] == 'prepopulate' && $node->type == 'recipe') {
    foreach ($node->recipe_ingredients['ing'] as $delta => $ing) {
      $node->recipe_ingredients['ing'][$delta]['ri_id'] = NULL;
      $node->recipe_ingredients['ing'][$delta]['ingredient_id'] = NULL;
    }
  }
}