wiki.techinc.nl/includes/htmlform/HTMLButtonField.php
addshore 8fa2314b2e Formatting fixes in includes/htmlform/*
Change-Id: Iee9e4f3fcf8491022ffe97c74312871f97f8ce9c
2013-12-09 14:23:05 +01:00

46 lines
956 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,
);
if ( !empty( $this->mParams['disabled'] ) ) {
$attr['disabled'] = 'disabled';
}
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;
}
}