From 04f7572ea10915b7cb83a7ac1e19a5be78e236cf Mon Sep 17 00:00:00 2001 From: John Du Hart Date: Sun, 23 Oct 2011 18:09:44 +0000 Subject: [PATCH] HTMLForm is now a context source. Replace wfMessage() calls with $this->msg() --- includes/HTMLForm.php | 39 ++++----------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 11e477b242..f97519ce1f 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -53,7 +53,7 @@ * * TODO: Document 'section' / 'subsection' stuff */ -class HTMLForm { +class HTMLForm extends ContextSource { # A mapping of 'type' inputs onto standard HTMLFormField subclasses static $typeMappings = array( @@ -105,7 +105,6 @@ class HTMLForm { protected $mSubmitText; protected $mSubmitTooltip; - protected $mContext; // mContext = $context; + $this->setContext( $context ); $this->mTitle = false; // We don't need them to set a title $this->mMessagePrefix = $messagePrefix; } else { @@ -586,7 +585,7 @@ class HTMLForm { * @param $msg String message key */ public function setSubmitTextMsg( $msg ) { - return $this->setSubmitText( wfMessage( $msg )->escaped() ); + return $this->setSubmitText( $this->msg( $msg )->escaped() ); } /** @@ -634,7 +633,7 @@ class HTMLForm { * @param $msg String message key */ public function setWrapperLegendMsg( $msg ) { - return $this->setWrapperLegend( wfMessage( $msg )->escaped() ); + return $this->setWrapperLegend( $this->msg( $msg )->escaped() ); } /** @@ -665,36 +664,6 @@ class HTMLForm { : $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 -- 2.20.1