From: Happy-melon Date: Sun, 6 Sep 2009 14:32:03 +0000 (+0000) Subject: Allow password fields to be served by HTMLForm. X-Git-Tag: 1.31.0-rc.0~39898 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=884b94f43be7e3f0261e3dbb70f940ebaf93c897;p=lhc%2Fweb%2Fwiklou.git Allow password fields to be served by HTMLForm. --- diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 35fb020ffe..1db26fe37a 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -21,6 +21,7 @@ class HTMLForm { 'int' => 'HTMLIntField', 'float' => 'HTMLFloatField', 'info' => 'HTMLInfoField', + 'password' => 'HTMLPasswordField', 'selectorother' => 'HTMLSelectOrOtherField', # HTMLTextField will output the correct type="" attribute automagically. # There are about four zillion other HTML 5 input types, like url, but @@ -515,6 +516,9 @@ abstract class HTMLFormField { } class HTMLTextField extends HTMLFormField { + # Override in derived classes to use other Xml::... functions + protected $mFunction = 'input'; + function getSize() { return isset( $this->mParams['size'] ) ? $this->mParams['size'] : 45; } @@ -562,7 +566,8 @@ class HTMLTextField extends HTMLFormField { } } - return Xml::input( + $func = $this->mFunction; + return Xml::$func( $this->mName, $this->getSize(), $value, @@ -571,6 +576,10 @@ class HTMLTextField extends HTMLFormField { } } +class HTMLPasswordField extends HTMLTextField { + protected $mFunction = 'password'; +} + class HTMLFloatField extends HTMLTextField { function getSize() { return isset( $this->mParams['size'] ) ? $this->mParams['size'] : 20;