function _autocomplete_widgets_sort_options in Autocomplete Widgets for Text and Number Fields 7
Sort an array of options fo the given field instance.
2 calls to _autocomplete_widgets_sort_options()
- _autocomplete_widgets_get_options_allowvals in ./
autocomplete_widgets.common.inc - Fetch an array of options for the given widget (allowed values).
- _autocomplete_widgets_get_options_suggested in ./
autocomplete_widgets.common.inc - Fetch an array of options for the given widget (suggested).
File
- ./
autocomplete_widgets.common.inc, line 342 - Common functions for Autocomplete Widgets module.
Code
function _autocomplete_widgets_sort_options(&$options, $instance) {
if (isset($instance['widget']['settings']['order'])) {
switch ($instance['widget']['settings']['order']) {
case 'ASC':
asort($options);
break;
case 'DESC':
arsort($options);
break;
}
}
}