MediaWiki  1.33.0
HTMLExpiryField.php
Go to the documentation of this file.
1 <?php
2 
4 
10 
14  protected $relativeField;
15 
20  public function __construct( array $params = [] ) {
21  parent::__construct( $params );
22 
23  $type = !empty( $params['options'] ) ? 'selectorother' : 'text';
24  $this->relativeField = $this->getFieldByType( $type );
25  }
26 
32  public function getInputHTML( $value ) {
33  return $this->relativeField->getInputHTML( $value );
34  }
35 
36  protected function shouldInfuseOOUI() {
37  return true;
38  }
39 
43  protected function getOOUIModules() {
44  return array_merge(
45  [
46  'mediawiki.widgets.expiry',
47  ],
48  $this->relativeField->getOOUIModules()
49  );
50  }
51 
55  public function getInputOOUI( $value ) {
56  return new ExpiryInputWidget(
57  $this->relativeField->getInputOOUI( $value ),
58  [
59  'id' => $this->mID,
60  'required' => $this->mParams['required'] ?? false,
61  ]
62  );
63  }
64 
68  public function loadDataFromRequest( $request ) {
69  return $this->relativeField->loadDataFromRequest( $request );
70  }
71 
78  protected function getFieldByType( $type ) {
81  $params['type'] = $type;
82  $params['class'] = $class;
83 
84  // Remove Parameters that are being used on the parent.
85  unset( $params['label-message'] );
86  return new $class( $params );
87  }
88 
89 }
HTMLForm\$typeMappings
static $typeMappings
Definition: HTMLForm.php:135
HTMLExpiryField\getInputHTML
getInputHTML( $value)
@inheritDoc
Definition: HTMLExpiryField.php:32
MediaWiki\Widget\ExpiryInputWidget
Expiry widget.
Definition: ExpiryInputWidget.php:16
HTMLExpiryField\getInputOOUI
getInputOOUI( $value)
@inheritDoc
Definition: HTMLExpiryField.php:55
$params
$params
Definition: styleTest.css.php:44
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:35
HTMLExpiryField\shouldInfuseOOUI
shouldInfuseOOUI()
Whether the field should be automatically infused.
Definition: HTMLExpiryField.php:36
HTMLExpiryField\loadDataFromRequest
loadDataFromRequest( $request)
@inheritDoc
Definition: HTMLExpiryField.php:68
HTMLFormField
The parent class to generate form fields.
Definition: HTMLFormField.php:7
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
array
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
HTMLFormField\$mID
$mID
Definition: HTMLFormField.php:15
$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:2636
$value
$value
Definition: styleTest.css.php:49
HTMLFormField\$mParams
$mParams
Definition: HTMLFormField.php:8
HTMLExpiryField\$relativeField
HTMLFormField $relativeField
Definition: HTMLExpiryField.php:14
HTMLExpiryField\getFieldByType
getFieldByType( $type)
Get the HTMLForm field by the type string.
Definition: HTMLExpiryField.php:78
HTMLExpiryField
Expiry Field that allows the user to specify a precise date or a relative date string.
Definition: HTMLExpiryField.php:9
HTMLExpiryField\getOOUIModules
getOOUIModules()
@inheritDoc
Definition: HTMLExpiryField.php:43
HTMLExpiryField\__construct
__construct(array $params=[])
Relative Date Time Field.
Definition: HTMLExpiryField.php:20
$type
$type
Definition: testCompression.php:48