From 9175d8e37f7ad5faa741fd9fee089c5f25e297db Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Sun, 29 Jan 2012 15:23:23 +0000 Subject: [PATCH] allow people to actually specify post targets with a query --- includes/HTMLForm.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 41a12c1d22..3999e67e5a 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -107,6 +107,12 @@ class HTMLForm extends ContextSource { protected $mTitle; protected $mMethod = 'post'; + + /** + * @since 1.19 + * @var false|string + */ + protected $mAction = false; protected $mUseMultipart = false; protected $mHiddenFields = array(); @@ -472,7 +478,7 @@ class HTMLForm extends ContextSource { : 'application/x-www-form-urlencoded'; # Attributes $attribs = array( - 'action' => $this->getTitle()->getFullURL(), + 'action' => $this->mAction === false ? $this->getTitle()->getFullURL() : $this->mAction, 'method' => $this->mMethod, 'class' => 'visualClear', 'enctype' => $encType, @@ -845,6 +851,19 @@ class HTMLForm extends ContextSource { public function getLegend( $key ) { return wfMsg( "{$this->mMessagePrefix}-$key" ); } + + /** + * Set the value for the action attribute of the form. + * When set to false (which is the default state), the set title is used. + * + * @since 1.19 + * + * @param string|false $action + */ + public function setAction( $action ) { + $this->mAction = $action; + } + } /** -- 2.20.1