You are here

function sf_prematch_delete_form in Salesforce Suite 7.2

Same name and namespace in other branches
  1. 6.2 sf_prematch/sf_prematch.admin.inc \sf_prematch_delete_form()
  2. 7 sf_prematch/sf_prematch.admin.inc \sf_prematch_delete_form()

@todo Please document this function.

See also

http://drupal.org/node/1354

1 string reference to 'sf_prematch_delete_form'
sf_prematch_menu in sf_prematch/sf_prematch.module
Implements hook_menu().

File

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

Code

function sf_prematch_delete_form($form, &$form_state, $map) {
  $match_by = sf_prematch_match_by_load($map->name);

  // 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['name'] = array(
    '#type' => 'value',
    '#value' => $map->name,
  );

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