You are here

function sf_prematch_get_options in Salesforce Suite 7

Same name and namespace in other branches
  1. 6.2 sf_prematch/sf_prematch.admin.inc \sf_prematch_get_options()
  2. 7.2 sf_prematch/sf_prematch.admin.inc \sf_prematch_get_options()
1 call to sf_prematch_get_options()
sf_prematch_edit_form in sf_prematch/sf_prematch.admin.inc

File

sf_prematch/sf_prematch.admin.inc, line 214
Admin functions for sf_prematch module.

Code

function sf_prematch_get_options($map, $required = false) {

  // Extract terms from $map.
  if ($map['action'] == 'import') {
    $terms = array_keys($map['fields']);
  }
  else {
    $terms = array_values($map['fields']);
  }
  sort($terms);

  // Build terms into ordered options to use in select.
  $options = array();

  // Start with empty option if select is not required.
  if (!$required) {
    $options[] = '';
  }

  // Add terms to options, making key = value so form value is key not integer.
  foreach ($terms as $term) {
    $options[$term] = $term;
  }
  return $options;
}