You are here

function salesforce_api_fieldmap_objects in Salesforce Suite 7

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.2 salesforce_api/salesforce_api.module \salesforce_api_fieldmap_objects()

Implements hook_fieldmap_objects().

This will pull a cached version (if possible) of the available SF fields for the object(s) in question. Prevent excess querying!

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 299
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 (!$cache || $cache->data == '') {
      $objects = salesforce_api_cache_build();
    }
    else {

      // to mimic drupal 7's data structure -- entity->bundle->data -- add a
      // redundant layer of indirection here.
      $objects = $cache->data;
    }
  }
  return array(
    'salesforce' => $objects,
  );
}