You are here

function node_convert_template_info in Node Convert 7

Same name and namespace in other branches
  1. 6 node_convert.module \node_convert_template_info()

Template info page callback.

1 string reference to 'node_convert_template_info'
node_convert_menu in ./node_convert.module
Implements hook_menu().

File

./node_convert.admin.inc, line 35
Administration page callbacks for the node_convert module.

Code

function node_convert_template_info($machine_name) {
  $output = '';
  $rows = array();
  $headers = array(
    t("Property"),
    t("Value"),
  );
  $row = node_convert_load_template($machine_name);
  $template_id = isset($row['nctid']) ? $row['nctid'] : t('In Code');
  $rows[] = array(
    t("Template id"),
    $template_id,
  );
  $rows[] = array(
    t("Name"),
    $row['name'],
  );
  $rows[] = array(
    t("Machine name"),
    $row['machine_name'],
  );
  $rows[] = array(
    t("Source type"),
    $row['source_type'],
  );
  $rows[] = array(
    t("Destination type"),
    $row['destination_type'],
  );
  $data = $row['data'];
  if ($data['no_fields'] == FALSE) {
    $source_fields_string = implode(', ', $data['fields']['source']);
    $dest_fields_string = implode(', ', $data['fields']['destination']);
    $rows[] = array(
      t("Source fields"),
      $source_fields_string,
    );
    $rows[] = array(
      t("Destination fields"),
      $dest_fields_string,
    );
  }
  if (!empty($data['hook_options'])) {
    $rows[] = array(
      t("Hook options"),
      print_r($data['hook_options'], TRUE),
    );
  }
  $output .= theme('table', array(
    'header' => $headers,
    'rows' => $rows,
  ));
  return $output;
}