MediaWiki REL1_33
HTMLHiddenField.php
Go to the documentation of this file.
1<?php
2
4 protected $outputAsDefault = true;
5
6 public function __construct( $params ) {
7 parent::__construct( $params );
8
9 if ( isset( $this->mParams['output-as-default'] ) ) {
10 $this->outputAsDefault = (bool)$this->mParams['output-as-default'];
11 }
12
13 # Per HTML5 spec, hidden fields cannot be 'required'
14 # https://www.w3.org/TR/html5/forms.html#hidden-state-%28type=hidden%29
15 unset( $this->mParams['required'] );
16 }
17
18 public function getHiddenFieldData( $value ) {
19 $params = [];
20 if ( $this->mID ) {
21 $params['id'] = $this->mID;
22 }
23
24 if ( $this->outputAsDefault ) {
26 }
27
28 return [ $this->mName, $value, $params ];
29 }
30
31 public function getTableRow( $value ) {
33 $this->mParent->addHiddenField( $name, $value, $params );
34 return '';
35 }
36
42 public function getDiv( $value ) {
43 return $this->getTableRow( $value );
44 }
45
51 public function getRaw( $value ) {
52 return $this->getTableRow( $value );
53 }
54
55 public function getInputHTML( $value ) {
56 return '';
57 }
58
59 public function canDisplayErrors() {
60 return false;
61 }
62
63 public function hasVisibleOutput() {
64 return false;
65 }
66}
The parent class to generate form fields.
getInputHTML( $value)
This function must be implemented to return the HTML to generate the input object itself.
getTableRow( $value)
Get the complete table row for the input, including help text, labels, and whatever.
__construct( $params)
Initialise the object.
canDisplayErrors()
True if this field type is able to display errors; false if validation errors need to be displayed in...
hasVisibleOutput()
If this field has a user-visible output or not.
getHiddenFieldData( $value)
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition deferred.txt:11
Allows to change the fields on the form that will be generated $name
Definition hooks.txt:271
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition injection.txt:37
$params