dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Provide VRS objects with a name for more informative debugging/logging"
[lhc/web/wiklou.git]
/
includes
/
htmlform
/
HTMLHiddenField.php
diff --git
a/includes/htmlform/HTMLHiddenField.php
b/includes/htmlform/HTMLHiddenField.php
index
6ea95ed
..
ffde915
100644
(file)
--- a/
includes/htmlform/HTMLHiddenField.php
+++ b/
includes/htmlform/HTMLHiddenField.php
@@
-1,26
+1,42
@@
<?php
class HTMLHiddenField extends HTMLFormField {
<?php
class HTMLHiddenField extends HTMLFormField {
+ protected $outputAsDefault = true;
+
public function __construct( $params ) {
parent::__construct( $params );
public function __construct( $params ) {
parent::__construct( $params );
+ if ( isset( $this->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'] );
}
# 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 get
TableRow
( $value ) {
+ public function get
HiddenFieldData
( $value ) {
$params = array();
if ( $this->mID ) {
$params['id'] = $this->mID;
}
$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 '';
}
/**
return '';
}
/**
+ * @param string $value
+ * @return string
* @since 1.20
*/
public function getDiv( $value ) {
* @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 ) {
* @since 1.20
*/
public function getRaw( $value ) {