*
* TODO: Document 'section' / 'subsection' stuff
*/
-class HTMLForm {
+class HTMLForm extends ContextSource {
# A mapping of 'type' inputs onto standard HTMLFormField subclasses
static $typeMappings = array(
protected $mSubmitText;
protected $mSubmitTooltip;
- protected $mContext; // <! IContextSource
protected $mTitle;
protected $mMethod = 'post';
*/
public function __construct( $descriptor, /*IContextSource*/ $context = null, $messagePrefix = '' ) {
if( $context instanceof IContextSource ){
- $this->mContext = $context;
+ $this->setContext( $context );
$this->mTitle = false; // We don't need them to set a title
$this->mMessagePrefix = $messagePrefix;
} else {
* @param $msg String message key
*/
public function setSubmitTextMsg( $msg ) {
- return $this->setSubmitText( wfMessage( $msg )->escaped() );
+ return $this->setSubmitText( $this->msg( $msg )->escaped() );
}
/**
* @param $msg String message key
*/
public function setWrapperLegendMsg( $msg ) {
- return $this->setWrapperLegend( wfMessage( $msg )->escaped() );
+ return $this->setWrapperLegend( $this->msg( $msg )->escaped() );
}
/**
: $this->mTitle;
}
- /**
- * @return IContextSource
- */
- public function getContext(){
- return $this->mContext instanceof IContextSource
- ? $this->mContext
- : RequestContext::getMain();
- }
-
- /**
- * @return OutputPage
- */
- public function getOutput(){
- return $this->getContext()->getOutput();
- }
-
- /**
- * @return WebRequest
- */
- public function getRequest(){
- return $this->getContext()->getRequest();
- }
-
- /**
- * @return User
- */
- public function getUser(){
- return $this->getContext()->getUser();
- }
-
/**
* Set the method used to submit the form
* @param $method String