MediaWiki  1.34.0
ExpiryInputWidget.php
Go to the documentation of this file.
1 <?php
2 
3 namespace MediaWiki\Widget;
4 
5 use OOUI\Widget;
6 
16 class ExpiryInputWidget extends Widget {
17 
21  protected $relativeInput;
22 
26  protected $required;
27 
32  public function __construct( Widget $relativeInput, array $options = [] ) {
33  parent::__construct( $options );
34 
35  $this->required = $options['required'] ?? false;
36 
37  // Properties
38  $this->relativeInput = $relativeInput;
39  $this->relativeInput->addClasses( [ 'mw-widget-ExpiryWidget-relative' ] );
40 
41  // Initialization
42  $this
43  ->addClasses( [
44  'mw-widget-ExpiryWidget',
45  'mw-widget-ExpiryWidget-hasDatePicker'
46  ] )
47  ->appendContent( $this->relativeInput );
48  }
49 
50  protected function getJavaScriptClassName() {
51  return 'mw.widgets.ExpiryWidget';
52  }
53 
57  public function getConfig( &$config ) {
58  $config['required'] = $this->required;
59  $config['relativeInput'] = [];
60  $this->relativeInput->getConfig( $config['relativeInput'] );
61  return parent::getConfig( $config );
62  }
63 }
MediaWiki\Widget\ExpiryInputWidget
Expiry widget.
Definition: ExpiryInputWidget.php:16
MediaWiki\Widget\ExpiryInputWidget\$relativeInput
Widget $relativeInput
Definition: ExpiryInputWidget.php:21
MediaWiki\Widget\ExpiryInputWidget\getJavaScriptClassName
getJavaScriptClassName()
Definition: ExpiryInputWidget.php:50
MediaWiki\Widget\ExpiryInputWidget\getConfig
getConfig(&$config)
Definition: ExpiryInputWidget.php:57
MediaWiki\Widget\ExpiryInputWidget\__construct
__construct(Widget $relativeInput, array $options=[])
Definition: ExpiryInputWidget.php:32
MediaWiki\Widget
Definition: CheckMatrixWidget.php:3
MediaWiki\$config
Config $config
Definition: MediaWiki.php:43
MediaWiki\Widget\ExpiryInputWidget\$required
bool $required
Definition: ExpiryInputWidget.php:26