relativeField = $this->getFieldByType( $type ); } /** * {@inheritdoc} * * Use whatever the relative field is as the standard HTML input. */ public function getInputHTML( $value ) { return $this->relativeField->getInputHTML( $value ); } protected function shouldInfuseOOUI() { return true; } /** * {@inheritdoc} */ protected function getOOUIModules() { return array_merge( [ 'mediawiki.widgets.expiry', ], $this->relativeField->getOOUIModules() ); } /** * {@inheritdoc} */ public function getInputOOUI( $value ) { return new ExpiryInputWidget( $this->relativeField->getInputOOUI( $value ), [ 'id' => $this->mID, 'required' => $this->mParams['required'] ?? false, ] ); } /** * {@inheritdoc} */ public function loadDataFromRequest( $request ) { return $this->relativeField->loadDataFromRequest( $request ); } /** * Get the HTMLForm field by the type string. * * @param string $type * @return \HTMLFormField */ protected function getFieldByType( $type ) { $class = HTMLForm::$typeMappings[$type]; $params = $this->mParams; $params['type'] = $type; $params['class'] = $class; // Remove Parameters that are being used on the parent. unset( $params['label-message'] ); return new $class( $params ); } }