mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-06-08 05:45:53 -04:00
Added the ability to specify a class for <select><option> in the htmlSelect() function (functions.php)
This commit is contained in:
@@ -424,7 +424,7 @@ function htmlOptions($options, $values) {
|
||||
$has_selected = false;
|
||||
foreach ( $options as $value=>$option ) {
|
||||
$disabled = 0;
|
||||
$text = '';
|
||||
$text = $class = '';
|
||||
if ( is_array($option) ) {
|
||||
|
||||
if ( isset($option['Name']) )
|
||||
@@ -435,6 +435,9 @@ function htmlOptions($options, $values) {
|
||||
if ( isset($option['disabled']) ) {
|
||||
$disabled = $option['disabled'];
|
||||
}
|
||||
if ( isset($option['class']) ) {
|
||||
$class = $option['class'];
|
||||
}
|
||||
} else if ( is_object($option) ) {
|
||||
$text = $option->Name();
|
||||
} else {
|
||||
@@ -450,6 +453,7 @@ function htmlOptions($options, $values) {
|
||||
$options_html .= '<option value="'.htmlspecialchars($value, ENT_COMPAT | ENT_HTML401, ini_get('default_charset'), false).'"'.
|
||||
($selected?' selected="selected"':'').
|
||||
($disabled?' disabled="disabled"':'').
|
||||
($class?' class='.$class:'').
|
||||
'>'.htmlspecialchars($text, ENT_COMPAT | ENT_HTML401, ini_get('default_charset'), false).'</option>'.PHP_EOL;
|
||||
} # end foreach options
|
||||
if ( $values and ((!is_array($values)) or count($values) ) and ! $has_selected ) {
|
||||
|
||||
Reference in New Issue
Block a user