wiki.techinc.nl/includes/htmlform/fields/HTMLTextFieldWithButton.php
James D. Forrester 59c0aa2134 Namespace HTMLForm and friends
Bug: T353458
Change-Id: I09e66c3223018ec47e0549ee7f6a590b676f4eef
2024-02-14 08:18:33 -05:00

36 lines
960 B
PHP

<?php
namespace MediaWiki\HTMLForm\Field;
use MediaWiki\HTMLForm\HTMLFormActionFieldLayout;
/**
* Creates a text input field with a button assigned to the input field.
*
* @stable to extend
*/
class HTMLTextFieldWithButton extends HTMLTextField {
/** @var HTMLFormFieldWithButton */
protected $mClassWithButton = null;
/**
* @stable to call
* @inheritDoc
*/
public function __construct( $info ) {
$this->mClassWithButton = new HTMLFormFieldWithButton( $info );
parent::__construct( $info );
}
public function getInputHTML( $value ) {
return $this->mClassWithButton->getElement( parent::getInputHTML( $value ) );
}
protected function getFieldLayoutOOUI( $inputField, $config ) {
$buttonWidget = $this->mClassWithButton->getInputOOUI( '' );
return new HTMLFormActionFieldLayout( $inputField, $buttonWidget, $config );
}
}
/** @deprecated since 1.42 */
class_alias( HTMLTextFieldWithButton::class, 'HTMLTextFieldWithButton' );