You are here

function node_convert_conversion_form_submit in Node Convert 5

Same name and namespace in other branches
  1. 6 node_convert.module \node_convert_conversion_form_submit()
  2. 7 node_convert.forms.inc \node_convert_conversion_form_submit()

File

./node_convert.module, line 145

Code

function node_convert_conversion_form_submit($form_id, $form_values) {
  if ($form_values['step'] == "choose_destination_fields") {

    // Information needed in the convert process: nid, vid, source type, destination type
    $dest_node_type = $form_values['destination_type'];
    $nid = $form_values['nid'];
    $node = node_load($nid);
    $vid = $node->vid;
    $source_node_type = $node->type;
    $no_fields_flag = $form_values['no_fields_flag'];
    if ($form_values['no_fields_flag'] == false) {

      // If there are cck fields that can to be converted
      foreach ($form_values as $key => $value) {
        if (preg_match("/source_field_[0-9]+?/", $key) == 1) {
          $source_fields[] = $value;
        }

        //  Source fields
        if (preg_match("/dest_field_[0-9]+?/", $key) == 1) {
          $dest_fields[] = $value;
        }

        // Destination fields
      }
    }
    node_convert_node_convert($nid, $dest_node_type, $source_fields, $dest_fields, $no_fields_flag);
    drupal_set_message("The current node type has been changed succesufuly");
    drupal_goto("node/" . $nid);
  }
}