X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FXmlSelect.php;h=45002e82f66ee39becf44f0233fef6181b6d26c1;hb=ef752a33bbc796ec7c3d555e43c02f611af8c29a;hp=1cd04ae10e27e30f4feb0c0782bf18bf65046045;hpb=9c092814c7f275db78a6ed769aa76fdd87709c60;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/XmlSelect.php b/includes/XmlSelect.php index 1cd04ae10e..45002e82f6 100644 --- a/includes/XmlSelect.php +++ b/includes/XmlSelect.php @@ -1,6 +1,6 @@ . + * Class for generating HTML elements + * Class for generating HTML probably has the multiple attribute, + // so we should check if each $value is in $default, rather than checking if + // $value is equal to $default. + $selected = is_array( $default ) ? in_array( $value, $default ) : $value === $default; + $data .= Xml::option( $label, $value, $selected ) . "\n"; } } @@ -125,6 +131,6 @@ class XmlSelect { $contents .= self::formatOptions( $options, $this->default ); } - return Html::rawElement( 'select', $this->attributes, rtrim( $contents ) ); + return Html::rawElement( $this->tagName, $this->attributes, rtrim( $contents ) ); } }