You are here

function clone_form_alter in Node clone 6

Implementation of hook_form_alter().

File

./clone.module, line 122
Allow users to make a copy of an item of content (a node) and then edit that copy.

Code

function clone_form_alter(&$form, $form_state, $form_id) {

  // Add the clone_from_original_nid value for node forms triggered by cloning.
  // This will make sure the clone_from_original_nid property is still
  // attached to the node when passing through hook_nodeapi($op = insert).
  if (isset($form['#node']) && $form['#node']->type . '_node_form' == $form_id) {
    if (!empty($form['#node']->clone_from_original_nid)) {
      $form['clone_from_original_nid'] = array(
        '#type' => 'value',
        '#value' => $form['#node']->clone_from_original_nid,
      );
    }
  }
}