* * New Optgroup header * Plus a text field underneath for an additional reason. The 'value' of the field is * "","") */ function loadDataFromRequest( $request ) { if ( $request->getCheck( $this->mName ) ) { $list = $request->getText( $this->mName ); $text = $request->getText( $this->mName . '-other' ); if ( $list == 'other' ) { $final = $text; } elseif ( !in_array( $list, $this->mFlatOptions, true ) ) { # User has spoofed the select form to give an option which wasn't # in the original offer. Sulk... $final = $text; } elseif ( $text == '' ) { $final = $list; } else { $final = $list . $this->msg( 'colon-separator' )->inContentLanguage()->text() . $text; } } else { $final = $this->getDefault(); $list = 'other'; $text = $final; foreach ( $this->mFlatOptions as $option ) { $match = $option . $this->msg( 'colon-separator' )->inContentLanguage()->text(); if ( strpos( $text, $match ) === 0 ) { $list = $option; $text = substr( $text, strlen( $match ) ); break; } } } return array( $final, $list, $text ); } function getSize() { return isset( $this->mParams['size'] ) ? $this->mParams['size'] : 45; } function validate( $value, $alldata ) { # HTMLSelectField forces $value to be one of the options in the select # field, which is not useful here. But we do want the validation further up # the chain $p = parent::validate( $value[1], $alldata ); if ( $p !== true ) { return $p; } if ( isset( $this->mParams['required'] ) && $this->mParams['required'] !== false && $value[1] === '' ) { return $this->msg( 'htmlform-required' )->parse(); } return true; } }