$name = (bool) $value; break; default: parent::__set( $name, $value ); } } protected function get_options() { return $this->options; } public function output() { $output = array( 'get_id() . '"'; $output[] = ' name="' . $this->get_name() . ( $this->multiple ? '[]' : '' ) . '"'; if ( ! $this->autocomplete ) $output[] = ' autocomplete="off"'; if ( $this->multiple ) $output[] = ' multiple'; if ( $this->class ) $output[] = ' class="' . $this->class . '"'; $output[] = '>'; $options = $this->get_options(); if ( is_array( $options ) ) { foreach ( $options as $key => $val ) { $output[] = sprintf( '', htmlspecialchars( $key, ENT_COMPAT, 'UTF-8' ), $key === $this->value ? ' selected' : '', esc_html( $val ) ); } } $output[] = ''; return implode( $output ); } }