function salesforce_api_fieldmap_target_enabled in Salesforce Suite 7.2
Same name and namespace in other branches
- 6.2 salesforce_api/salesforce_api.module \salesforce_api_fieldmap_target_enabled()
Helper function to determine whether the Salesforce object (target) for a given fieldmap is available.
Parameters
object $map:
boolean $enable (optional) -: if the object is not initially available, whether or not to try and enable it before returning.
Return value
boolean
2 calls to salesforce_api_fieldmap_target_enabled()
- salesforce_api_fieldmap_edit_form in salesforce_api/
salesforce_api.admin.inc - salesforce_api_import_salesforce_fieldmap_validate in salesforce_api/
salesforce_api.module - Validation function for salesforce_api_import_fieldmap(). Makes sure that an import actually provides a handler.
File
- salesforce_api/
salesforce_api.module, line 2269 - Defines an API that enables modules to interact with the Salesforce server.
Code
function salesforce_api_fieldmap_target_enabled($map, $enable = TRUE) {
$sf_objects = variable_get('salesforce_api_enabled_objects', array(
'Campaign',
'Contact',
'Lead',
));
if ($enable && !in_array($map->salesforce, $sf_objects)) {
$sf_objects[] = $map->salesforce;
variable_set('salesforce_api_enabled_objects', array_filter($sf_objects));
salesforce_api_cache_build();
}
// Load the Salesforce fieldmap objects fresh (not from cache), to see if the WSDL defines the object.
$target = salesforce_api_fieldmap_objects_load('salesforce', 'salesforce', $map->salesforce, $reset = TRUE);
return !empty($target);
}