You are here

function clone_node_check in Node clone 7

Same name and namespace in other branches
  1. 5 clone.module \clone_node_check()
  2. 6 clone.pages.inc \clone_node_check()

Menu callback: prompt the user to confirm the operation

1 string reference to 'clone_node_check'
clone_menu in ./clone.module
Implementation of hook_menu().

File

./clone.pages.inc, line 82
Additional functions for Node_Clone module.

Code

function clone_node_check($node) {
  $method = variable_get('clone_method', 'prepopulate');
  switch ($method) {
    case 'save-edit':
      if (variable_get('clone_nodes_without_confirm', FALSE)) {
        $new_nid = clone_node_save($node->nid);
        $options = array();
        if (!empty($_GET['node-clone-destination'])) {
          $options['query']['destination'] = $_GET['node-clone-destination'];
        }
        drupal_goto('node/' . $new_nid . '/edit', $options);
      }
      else {
        return drupal_get_form('clone_node_confirm', $node);
      }
      break;
    case 'prepopulate':
    default:
      return clone_node_prepopulate($node);
      break;
  }
}