You are here

function _salesforce_mapping_get_salesforce_record_type_options in Salesforce Suite 7.3

Helper to retreive a list of record type options for a given object type.

Parameters

string $salesforce_object_type: The object type of whose records you want to retreive.

array $form_state: Current state of the form to store and retreive results from to minimize the need for recalculation.

bool $include_select: Choice to choose a select option or not. If TRUE, the first item will be "-- Select --". If FALSE, the first item will be the first item of the retreived records. Defaults to TRUE.

Return value

array An array of values keyed by machine name of the record with the label as the value, formatted to be appropriate as a value for #options.

2 calls to _salesforce_mapping_get_salesforce_record_type_options()
salesforce_mapping_form in modules/salesforce_mapping/includes/salesforce_mapping.admin.inc
Return a form for a Salesforce mapping entity.
_salesforce_mapping_get_default_value in modules/salesforce_mapping/includes/salesforce_mapping.admin.inc
Helper to retrieve the current value for a given form field.

File

modules/salesforce_mapping/includes/salesforce_mapping.admin.inc, line 1071
Configuration page for creating and modifying a mapping.

Code

function _salesforce_mapping_get_salesforce_record_type_options($salesforce_object_type, &$form_state, $include_select = TRUE) {
  $sfobject = _salesforce_mapping_get_salesforce_object($salesforce_object_type, $form_state);
  $sf_types = array();
  if (isset($sfobject['recordTypeInfos'])) {
    if ($include_select) {
      $sf_types[''] = '- ' . t('Select record type') . ' -';
    }
    foreach ($sfobject['recordTypeInfos'] as $type) {
      $sf_types[$type['recordTypeId']] = $type['name'];
    }
  }
  return $sf_types;
}