69 $this->attributes[$name] = $value;
77 return $this->attributes[$name] ??
null;
84 public function addOption( $label, $value =
false ) {
85 $value = $value !==
false ? $value : $label;
86 $this->options[] = [ $label => $value ];
112 foreach (
$options as $label => $value ) {
113 if ( is_array( $value ) ) {
115 $data .= Html::rawElement(
'optgroup', [
'label' => $label ], $contents ) .
"\n";
121 $data .=
Xml::option( $label, $value, $selected ) .
"\n";
134 foreach ( $this->options as
$options ) {
138 return Html::rawElement( $this->tagName, $this->attributes, rtrim( $contents ) );
152 foreach ( explode(
',', $msg ) as $option ) {
154 if ( strpos( $option,
':' ) ===
false ) {
155 $option =
"$option:$option";
158 [ $label, $value ] = explode(
':', $option );
159 $options[ trim( $label ) ] = trim( $value );
165class_alias( XmlSelect::class,
'XmlSelect' );