You are here

function salesforce_api_fieldmap_field_options in Salesforce Suite 7

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

Returns a FAPI options array for specifying a field from the source object to associate with the target field.

Parameters

$object: The source object whose fields we need to filter into the options array.

$type: The type of the target field's object.

$name: The name of the target object.

$field: The name of the target field.

Return value

A FAPI options array of all the available fields that can map to the target field.

1 call to salesforce_api_fieldmap_field_options()
salesforce_api_fieldmap_edit_form in salesforce_api/salesforce_api.admin.inc
Displays the edit form for adding field associations to a fieldmap.

File

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

Code

function salesforce_api_fieldmap_field_options($object, $type = NULL, $name = NULL, $field = NULL) {

  // Define the options array with a blank value.
  $options = array(
    '' => '',
  );

  // TODO: Consider filtering these based on the object definition.  For now
  // this function simply uses any field defined for the source object.
  // Loop through all the fields of the source object.
  foreach ($object['fields'] as $key => $data) {

    // Add the field to the options array in the right options group.
    if (!empty($data['group'])) {
      $options[$data['group']][$key] = $data['label'];
    }
    else {
      $options[t('Core fields')][$key] = $data['label'];
    }
  }
  return $options;
}