X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fhtmlform%2FHTMLHiddenField.php;h=ffde9151f26b073043c494ee17b5b11a8483369f;hb=4d22e6ff4e13ebf34f45de935cc181fbd24e523f;hp=6ea95ed1447146769328e09c005fc4d9a36c9f71;hpb=01da3da43d18b123fe3679a6af21f046a78180d5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/htmlform/HTMLHiddenField.php b/includes/htmlform/HTMLHiddenField.php index 6ea95ed144..ffde9151f2 100644 --- a/includes/htmlform/HTMLHiddenField.php +++ b/includes/htmlform/HTMLHiddenField.php @@ -1,26 +1,42 @@ mParams['output-as-default'] ) ) { + $this->outputAsDefault = (bool)$this->mParams['output-as-default']; + } + # Per HTML5 spec, hidden fields cannot be 'required' # http://www.w3.org/TR/html5/forms.html#hidden-state-%28type=hidden%29 unset( $this->mParams['required'] ); } - public function getTableRow( $value ) { + public function getHiddenFieldData( $value ) { $params = array(); if ( $this->mID ) { $params['id'] = $this->mID; } - $this->mParent->addHiddenField( $this->mName, $this->mDefault, $params ); + if ( $this->outputAsDefault ) { + $value = $this->mDefault; + } + + return array( $this->mName, $value, $params ); + } + public function getTableRow( $value ) { + list( $name, $value, $params ) = $this->getHiddenFieldData( $value ); + $this->mParent->addHiddenField( $name, $value, $params ); return ''; } /** + * @param string $value + * @return string * @since 1.20 */ public function getDiv( $value ) { @@ -28,6 +44,8 @@ class HTMLHiddenField extends HTMLFormField { } /** + * @param string $value + * @return string * @since 1.20 */ public function getRaw( $value ) {