You are here

function sf_prematch_delete_form in Salesforce Suite 7

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

File

sf_prematch/sf_prematch.admin.inc, line 173
Admin functions for sf_prematch module.

Code

function sf_prematch_delete_form(&$form_state, $fieldmap) {

  // Load the fieldmap and prematch from the database.
  $map = salesforce_api_fieldmap_load($fieldmap);
  $match_by = sf_prematch_match_by_load($fieldmap);

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

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

  // Build the description text for this prematch.
  $desc = t('You are about to delete the prematch for fieldmap ');
  if ($map['action'] == 'import') {
    $desc .= t('@index. That fieldmap maps Salesforce %salesforce objects to Drupal %drupal objects for import.', array(
      '@index' => $map['fieldmap'],
      '%drupal' => $map['drupal'],
      '%salesforce' => $map['salesforce'],
    ));
  }
  else {
    $desc .= t('@index. That fieldmap maps Drupal %drupal objects to Salesforce %salesforce objects for export.', array(
      '@index' => $map['fieldmap'],
      '%drupal' => $map['drupal'],
      '%salesforce' => $map['salesforce'],
    ));
  }
  return confirm_form($form, t('Are you sure you want to delete this prematch?'), SALESFORCE_PATH_FIELDMAPS . '/prematching', $desc, t('Delete'));
}