function sf_prematch_get_options in Salesforce Suite 7.2
Same name and namespace in other branches
- 6.2 sf_prematch/sf_prematch.admin.inc \sf_prematch_get_options()
- 7 sf_prematch/sf_prematch.admin.inc \sf_prematch_get_options()
@todo Please document this function.
See also
1 call to sf_prematch_get_options()
- sf_prematch_edit_form in sf_prematch/
sf_prematch.admin.inc - @todo Please document this function.
File
- sf_prematch/
sf_prematch.admin.inc, line 258 - Admin functions for sf_prematch module.
Code
function sf_prematch_get_options($map, $required = FALSE) {
// Extract terms from $map.
if (isset($map->actions) && $map->actions == '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) {
if (is_array($term)) {
$term = implode(' : ', $term);
if (strlen($term) > 50) {
$term = substr($term, 0, 50) . ' ...';
}
}
$options[$term] = $term;
}
return $options;
}