It is already set for some fields in Special:Block, but are discarded by HTMLForm and its fields. Some notes: - fields with multiple inputs (radio, select and other, select or other) will have the same tabindex set on all elements - Some items such as multi-select and check matrix are not yet implemented Change-Id: I3e1ba7f16f3a3183f231afcf60dd392ce6d6eb6b
42 lines
926 B
PHP
42 lines
926 B
PHP
<?php
|
|
|
|
/**
|
|
* Adds a generic button inline to the form. Does not do anything, you must add
|
|
* click handling code in JavaScript. Use a HTMLSubmitField if you merely
|
|
* wish to add a submit button to a form.
|
|
*
|
|
* @since 1.22
|
|
*/
|
|
class HTMLButtonField extends HTMLFormField {
|
|
protected $buttonType = 'button';
|
|
|
|
public function __construct( $info ) {
|
|
$info['nodata'] = true;
|
|
parent::__construct( $info );
|
|
}
|
|
|
|
public function getInputHTML( $value ) {
|
|
$attr = array(
|
|
'class' => 'mw-htmlform-submit ' . $this->mClass,
|
|
'id' => $this->mID,
|
|
) + $this->getAttributes( array( 'disabled', 'tabindex' ) );
|
|
|
|
return Html::input( $this->mName, $value, $this->buttonType, $attr );
|
|
}
|
|
|
|
protected function needsLabel() {
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Button cannot be invalid
|
|
*
|
|
* @param $value String
|
|
* @param $alldata Array
|
|
*
|
|
* @return Bool
|
|
*/
|
|
public function validate( $value, $alldata ) {
|
|
return true;
|
|
}
|
|
}
|