MediaWiki  1.23.2
HTMLTextField.php
Go to the documentation of this file.
1 <?php
2 
3 class HTMLTextField extends HTMLFormField {
4  function getSize() {
5  return isset( $this->mParams['size'] ) ? $this->mParams['size'] : 45;
6  }
7 
8  function getInputHTML( $value ) {
9  $attribs = array(
10  'id' => $this->mID,
11  'name' => $this->mName,
12  'size' => $this->getSize(),
13  'value' => $value,
14  ) + $this->getTooltipAndAccessKey();
15 
16  if ( $this->mClass !== '' ) {
17  $attribs['class'] = $this->mClass;
18  }
19 
20  # @todo Enforce pattern, step, required, readonly on the server side as
21  # well
22  $allowedParams = array(
23  'min',
24  'max',
25  'pattern',
26  'title',
27  'step',
28  'placeholder',
29  'list',
30  'maxlength',
31  'tabindex',
32  'disabled',
33  'required',
34  'autofocus',
35  'multiple',
36  'readonly'
37  );
38 
39  $attribs += $this->getAttributes( $allowedParams );
40 
41  # Implement tiny differences between some field variants
42  # here, rather than creating a new class for each one which
43  # is essentially just a clone of this one.
44  if ( isset( $this->mParams['type'] ) ) {
45  switch ( $this->mParams['type'] ) {
46  case 'int':
47  $attribs['type'] = 'number';
48  break;
49  case 'float':
50  $attribs['type'] = 'number';
51  $attribs['step'] = 'any';
52  break;
53  # Pass through
54  case 'email':
55  case 'password':
56  case 'file':
57  case 'url':
58  $attribs['type'] = $this->mParams['type'];
59  break;
60  }
61  }
62 
63  return Html::element( 'input', $attribs );
64  }
65 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
HTMLFormField\$mClass
$mClass
Definition: HTMLFormField.php:15
HTMLTextField
Definition: HTMLTextField.php:3
Html\element
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:148
HTMLFormField
The parent class to generate form fields.
Definition: HTMLFormField.php:7
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
$value
$value
Definition: styleTest.css.php:45
HTMLFormField\getTooltipAndAccessKey
getTooltipAndAccessKey()
Returns the attributes required for the tooltip and accesskey.
Definition: HTMLFormField.php:479
HTMLTextField\getSize
getSize()
Definition: HTMLTextField.php:4
HTMLTextField\getInputHTML
getInputHTML( $value)
This function must be implemented to return the HTML to generate the input object itself.
Definition: HTMLTextField.php:8
$attribs
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
Definition: hooks.txt:1530
HTMLFormField\getAttributes
getAttributes(array $list)
Returns the given attributes from the parameters.
Definition: HTMLFormField.php:493