You are here

function salesforce_api_fieldmap_clone_form in Salesforce Suite 5.2

Same name and namespace in other branches
  1. 6.2 salesforce_api/salesforce_api.admin.inc \salesforce_api_fieldmap_clone_form()
  2. 7.2 salesforce_api/salesforce_api.admin.inc \salesforce_api_fieldmap_clone_form()
1 string reference to 'salesforce_api_fieldmap_clone_form'
salesforce_api_menu in salesforce_api/salesforce_api.module
Implementation of hook_menu().

File

salesforce_api/salesforce_api.admin.inc, line 148
Contains the admin page callbacks for the Salesforce module, including forms for general settings and fieldmap administration.

Code

function salesforce_api_fieldmap_clone_form($index) {

  // Load the fieldmap from the database.
  $map = salesforce_api_fieldmap_load($index);

  // Return to the admin page if the fieldmap did not exist.
  if (empty($map)) {
    drupal_set_message(t('That fieldmap does not exist.'), 'error');
    drupal_goto(SALESFORCE_PATH_FIELDMAPS);
  }
  $form = array();

  // Add the index to the form array.
  $form['fieldmap_index'] = array(
    '#type' => 'value',
    '#value' => $index,
  );

  // Add a description of the source fieldmap to the form array.
  $form['fieldmap_desc'] = array(
    '#value' => '<p>' . salesforce_api_fieldmap_description($map) . '</p>',
  );

  // Allow the user to change the action if needed.
  $form['fieldmap_action'] = array(
    '#type' => 'radios',
    '#title' => t('Action'),
    '#description' => t('Changing the action may result in some field associations being lost.'),
    '#options' => array(
      'import' => t('Import. This fieldmap will be used for importing data from Salesforce.'),
      'export' => t('Export. This fieldmap will be used for exporting data to Salesforce.'),
    ),
    '#default_value' => $map['action'],
    '#required' => TRUE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Clone fieldmap'),
    '#suffix' => l(t('Cancel'), SALESFORCE_PATH_FIELDMAPS),
  );
  return $form;
}