Fix missing commit() flag in postgres savepoint class
[mediawiki.git] / includes / htmlform / fields / HTMLHiddenField.php
blobc0fce2ba5db4f75920fe0c5400744e6f4dc212e4
1 <?php
3 class HTMLHiddenField extends HTMLFormField {
4 protected $outputAsDefault = true;
6 public function __construct( $params ) {
7 parent::__construct( $params );
9 if ( isset( $this->mParams['output-as-default'] ) ) {
10 $this->outputAsDefault = (bool)$this->mParams['output-as-default'];
13 # Per HTML5 spec, hidden fields cannot be 'required'
14 # http://www.w3.org/TR/html5/forms.html#hidden-state-%28type=hidden%29
15 unset( $this->mParams['required'] );
18 public function getHiddenFieldData( $value ) {
19 $params = [];
20 if ( $this->mID ) {
21 $params['id'] = $this->mID;
24 if ( $this->outputAsDefault ) {
25 $value = $this->mDefault;
28 return [ $this->mName, $value, $params ];
31 public function getTableRow( $value ) {
32 list( $name, $value, $params ) = $this->getHiddenFieldData( $value );
33 $this->mParent->addHiddenField( $name, $value, $params );
34 return '';
37 /**
38 * @param string $value
39 * @return string
40 * @since 1.20
42 public function getDiv( $value ) {
43 return $this->getTableRow( $value );
46 /**
47 * @param string $value
48 * @return string
49 * @since 1.20
51 public function getRaw( $value ) {
52 return $this->getTableRow( $value );
55 public function getInputHTML( $value ) {
56 return '';
59 public function canDisplayErrors() {
60 return false;
63 public function hasVisibleOutput() {
64 return false;