wiki.techinc.nl/includes/htmlform/HTMLButtonField.php
addshore 976276338a Split includes/HTMLForm
Change-Id: I6eabfdb064c0e35b69efe9d6142e94df4128b632
2013-12-08 23:13:56 +01:00

45 lines
No EOL
961 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;
}
}