mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 08:53:37 +01:00
$options can be a real array, still using the key as value e.g. ["no", "yes"]
This commit is contained in:
parent
de6c649bef
commit
703eb3ffc1
@ -326,12 +326,16 @@ class Select extends Etemplate\Widget
|
|||||||
/**
|
/**
|
||||||
* Get all values from an option array, which can be an associate array with values as key, or a "real" array or arrays with key "value"
|
* Get all values from an option array, which can be an associate array with values as key, or a "real" array or arrays with key "value"
|
||||||
*
|
*
|
||||||
|
* $options can be a real array, still using the key as value:
|
||||||
|
* - ["", "low", "normal", "high"]
|
||||||
|
*
|
||||||
* @param array|array[] $options incl. possible children
|
* @param array|array[] $options incl. possible children
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
static function optionValues(array $options)
|
static function optionValues(array $options)
|
||||||
{
|
{
|
||||||
if (!$options || (function_exists('array_is_list') && !array_is_list($options)) ||
|
if (!$options || !is_array(current($options)) || !isset(current($options)['value']) ||
|
||||||
|
(function_exists('array_is_list') && !array_is_list($options)) ||
|
||||||
(!function_exists('array_is_list') && !isset($options[0]) && !isset($options[count($options) - 1])))
|
(!function_exists('array_is_list') && !isset($options[0]) && !isset($options[count($options) - 1])))
|
||||||
{
|
{
|
||||||
return array_keys($options);
|
return array_keys($options);
|
||||||
|
Loading…
Reference in New Issue
Block a user