MediaWiki  REL1_31
HTMLSizeFilterField.php
Go to the documentation of this file.
1 <?php
2 
12  public function getSize() {
13  return isset( $this->mParams['size'] ) ? $this->mParams['size'] : 9;
14  }
15 
16  public function getInputHTML( $value ) {
17  $attribs = [];
18  if ( !empty( $this->mParams['disabled'] ) ) {
19  $attribs['disabled'] = 'disabled';
20  }
21 
23  $this->msg( 'minimum-size' )->text(),
24  $this->mName . '-mode',
25  'min',
26  $this->mID . '-mode-min',
27  $value >= 0,
28  $attribs
29  );
30  $html .= '&#160;' . Xml::radioLabel(
31  $this->msg( 'maximum-size' )->text(),
32  $this->mName . '-mode',
33  'max',
34  $this->mID . '-mode-max',
35  $value < 0,
36  $attribs
37  );
38  $html .= '&#160;' . parent::getInputHTML( $value ? abs( $value ) : '' );
39  $html .= '&#160;' . $this->msg( 'pagesize' )->parse();
40 
41  return $html;
42  }
43 
44  protected function getInputWidget( $params ) {
45  $this->mParent->getOutput()->addModuleStyles( 'mediawiki.widgets.SizeFilterWidget.styles' );
46 
47  // negative numbers represent "max", positive numbers represent "min"
48  $value = $params['value'];
49 
50  $params['value'] = $value ? abs( $value ) : '';
51 
53  'selectMin' => $value >= 0,
54  'textinput' => $params,
55  'radioselectinput' => [
56  'name' => $this->mName . '-mode',
57  'disabled' => !empty( $this->mParams['disabled'] ),
58  ],
59  ] );
60  }
61 
62  protected function getOOUIModules() {
63  return [ 'mediawiki.widgets.SizeFilterWidget' ];
64  }
65 
71  public function loadDataFromRequest( $request ) {
72  $size = $request->getInt( $this->mName );
73  if ( !$size ) {
74  return $this->getDefault();
75  }
76  $size = abs( $size );
77 
78  // negative numbers represent "max", positive numbers represent "min"
79  if ( $request->getVal( $this->mName . '-mode' ) === 'max' ) {
80  return -$size;
81  } else {
82  return $size;
83  }
84  }
85 
86  protected function needsLabel() {
87  return false;
88  }
89 }
MediaWiki\Widget\SizeFilterWidget
Select and input widget.
Definition: SizeFilterWidget.php:15
HTMLIntField
A field that must contain a number.
Definition: HTMLIntField.php:6
$html
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 & $html
Definition: hooks.txt:2013
text
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition: design.txt:18
$params
$params
Definition: styleTest.css.php:40
php
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
HTMLSizeFilterField\getInputHTML
getInputHTML( $value)
This function must be implemented to return the HTML to generate the input object itself.
Definition: HTMLSizeFilterField.php:16
HTMLSizeFilterField
A size filter field for use on query-type special pages.
Definition: HTMLSizeFilterField.php:11
$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:2014
HTMLSizeFilterField\loadDataFromRequest
loadDataFromRequest( $request)
Definition: HTMLSizeFilterField.php:71
$value
$value
Definition: styleTest.css.php:45
HTMLFormField\getDefault
getDefault()
Definition: HTMLFormField.php:972
HTMLSizeFilterField\getSize
getSize()
Definition: HTMLSizeFilterField.php:12
HTMLFormField\msg
msg()
Get a translated interface message.
Definition: HTMLFormField.php:77
HTMLSizeFilterField\getInputWidget
getInputWidget( $params)
Definition: HTMLSizeFilterField.php:44
Xml\radioLabel
static radioLabel( $label, $name, $value, $id, $checked=false, $attribs=[])
Convenience function to build an HTML radio button with a label.
Definition: Xml.php:445
HTMLSizeFilterField\needsLabel
needsLabel()
Should this field have a label, or is there no input element with the appropriate id for the label to...
Definition: HTMLSizeFilterField.php:86
HTMLSizeFilterField\getOOUIModules
getOOUIModules()
Get the list of extra ResourceLoader modules which must be loaded client-side before it's possible to...
Definition: HTMLSizeFilterField.php:62
$request
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
Definition: hooks.txt:2806