You are here

function salesforce_api_fieldmap_objects in Salesforce Suite 7.2

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

Implements hook_fieldmap_objects().

This will pull a cached version (if possible) of the available Salesforce fields for the object(s) in question. This helps prevent the Salesforce API query limit from being reached.

1 call to salesforce_api_fieldmap_objects()
salesforce_api_admin_object in salesforce_api/salesforce_api.admin.inc
Ask Salesforce for a list of objects and display a checklist for the user. Based on user selection, set up or tear down cached/synched Salesforce data. @todo make this more user-friendly. At the moment it's possible for an admin user to blow…

File

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

Code

function salesforce_api_fieldmap_objects($type = 'salesforce') {
  $objects = array();

  // Define the data fields available for Salesforce objects.
  if ($type == 'salesforce') {
    $cache = cache_get('salesforce_api_sf_objects');

    // If nothing is in the cache, then fetch the objects from Salesforce.
    if (empty($cache->data)) {
      $objects = salesforce_api_cache_build();
    }
    else {
      $objects = $cache->data;
    }
  }

  // To mimic the structure for the $objects array for Drupal objects,
  // (i.e., $objects[$entity_name][$bundle_name][$field_name]),
  // wrap the return value in 'salesforce'.
  return array(
    'salesforce' => $objects,
  );
}