You are here

function salesforce_api_fieldmap_add_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_add_form()
  2. 7 salesforce_api/salesforce_api.admin.inc \salesforce_api_fieldmap_add_form()
  3. 7.2 salesforce_api/salesforce_api.admin.inc \salesforce_api_fieldmap_add_form()
1 string reference to 'salesforce_api_fieldmap_add_form'
salesforce_api_menu in salesforce_api/salesforce_api.module
Implementation of hook_menu().

File

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

Code

function salesforce_api_fieldmap_add_form() {
  $form = array();

  // Build an options array out of the Drupal objects.
  $options = array();
  foreach (salesforce_api_fieldmap_objects_load('drupal') as $key => $value) {
    $options[$key] = $value['label'];
  }
  $form['drupal_object'] = array(
    '#type' => 'select',
    '#title' => t('Drupal object'),
    '#options' => count($options) > 0 ? $options : array(
      t('None available'),
    ),
    '#disabled' => count($options) == 0,
    '#required' => TRUE,
  );

  // Build an options array out of the Salesforce objects.
  $options = array();
  foreach (salesforce_api_fieldmap_objects_load('salesforce') as $key => $value) {
    $options[$key] = $value['label'];
  }
  $form['salesforce_object'] = array(
    '#type' => 'select',
    '#title' => t('Salesforce object'),
    '#options' => count($options) > 0 ? $options : array(
      t('None available'),
    ),
    '#disabled' => count($options) == 0,
    '#required' => TRUE,
  );
  $form['fieldmap_action'] = array(
    '#type' => 'radios',
    '#title' => t('Action'),
    '#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.'),
    ),
    '#required' => TRUE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Map object fields'),
    '#suffix' => l(t('Cancel'), SALESFORCE_PATH_FIELDMAPS),
  );
  return $form;
}