You are here

function salesforce_api_fieldmap_options in Salesforce Suite 7.2

Same name and namespace in other branches
  1. 5.2 salesforce_api/salesforce_api.module \salesforce_api_fieldmap_options()
  2. 6.2 salesforce_api/salesforce_api.module \salesforce_api_fieldmap_options()
  3. 7 salesforce_api/salesforce_api.module \salesforce_api_fieldmap_options()

Returns an array of fieldmaps for use as options in the Forms API.


$drupal_entity: Filters the fieldmaps by Drupal object.

$drupal_bundle: Filters the fieldmaps by Drupal bundle.

$salesforce: Filters the fieldmaps by Salesforce object.

$automatic: Optional: Filter the fieldmaps to only pull those marked automatic.

Return value

A FAPI options array of all the matching fieldmaps.

2 calls to salesforce_api_fieldmap_options()
sf_entity_salesforce_form in sf_entity/sf_entity.module
Displays the Salesforce synchronization form.
sf_entity_salesforce_form_access in sf_entity/sf_entity.module
Access callback for the Salesforce tab on entities.


salesforce_api/salesforce_api.module, line 869
Defines an API that enables modules to interact with the Salesforce server.


function salesforce_api_fieldmap_options($drupal_entity = NULL, $drupal_bundle = NULL, $salesforce = NULL, $automatic = NULL) {
  $options = array();

  // This does not need to not be optimized for performance since it's only an admin interface.
  $maps = salesforce_api_salesforce_fieldmap_load_all();
  foreach ($maps as $map) {
    if ($drupal_entity && $map->drupal_entity != $drupal_entity) {
    if ($drupal_bundle && $map->drupal_bundle != $drupal_bundle) {
    if ($salesforce && $map->salesforce != $salesforce) {
    if (is_array($map)) {
      $map = (object) $map;

    // Setup some replacement args for the label.
    $args = array(
      '@drupal' => salesforce_api_fieldmap_object_label('drupal', $map->drupal_entity, $map->drupal_bundle),
      '@salesforce' => salesforce_api_fieldmap_object_label('salesforce', 'salesforce', $map->salesforce),
    $options[$map->name] = t('Drupal @drupal to Salesforce @salesforce', $args);
  return $options;