You are here

function node_convert_save_template in Node Convert 7

Saves a conversion template.

1 call to node_convert_save_template()
node_convert_add_template_submit in ./node_convert.admin.inc
Submit callback for adding a new template.

File

./node_convert.module, line 417

Code

function node_convert_save_template($template_name, $machine_name, $source_type, $destination_type, $data, $is_editing_mode = FALSE) {
  $result = NULL;
  if (!$is_editing_mode) {
    $id = db_insert(NODE_CONVERT_TEMPLATE_TABLE)
      ->fields(array(
      'name' => $template_name,
      'machine_name' => $machine_name,
      'source_type' => $source_type,
      'destination_type' => $destination_type,
      'data' => $data,
    ))
      ->execute();
    $result = $id;
  }
  else {
    $rows_affected = db_update(NODE_CONVERT_TEMPLATE_TABLE)
      ->fields(array(
      'name' => $template_name,
      'source_type' => $source_type,
      'destination_type' => $destination_type,
      'data' => $data,
    ))
      ->condition('machine_name', $machine_name)
      ->execute();
    $result = $rows_affected;
  }
  return $result;
}