function facetapi_multiple_get_options in Facetapi Multiselect 7
Returns an array of all available options from an #options element.
This function takes into account optgroups, if they are present (the options contained within those will be merged into the returned array).
Parameters
$options: An #options array from a form element.
Return value
An array containing all options stored within the array. For a flat #options array (without optgroups), calling this function is equivalent to calling array_keys().
1 call to facetapi_multiple_get_options()
- facetapi_multiselect_form_submit in ./
facetapi_multiselect.module - Submit handler for facetapi_multiselect_form().
File
- ./
facetapi_multiselect.module, line 170 - Displays search facets as a multiselect widget.
Code
function facetapi_multiple_get_options($options) {
$all_options = array();
foreach ($options as $key => $option) {
if (is_array($option)) {
$all_options = array_merge($all_options, facetapi_multiple_get_options($option));
}
else {
$all_options[] = $key;
}
}
return $all_options;
}