19 $useMediaWikiUIEverywhere =
false;
20 if ( $this->mParent ) {
21 $useMediaWikiUIEverywhere = $this->mParent->getConfig()->get( MainConfigNames::UseMediaWikiUIEverywhere );
24 if ( !empty( $this->mParams[
'invert'] ) ) {
33 if ( $this->mClass !==
'' ) {
38 if ( isset( $attr[
'title'] ) ) {
40 $attrLabel[
'title'] = $attr[
'title'];
47 $attrClass = $attr[
'class'] ??
'';
48 $attr[
'class'] = $attrClass .
' cdx-checkbox__input';
49 $attrLabel[
'class'] =
'cdx-checkbox__label';
51 $chkDivider = $isCodexForm ?
52 "<span class=\"cdx-checkbox__icon\">\u{00A0}</span>" :
54 $chkLabel =
Xml::check( $this->mName, $value, $attr ) .
56 Html::rawElement(
'label', $attrLabel, $this->mLabel );
58 if ( $isCodexForm || $useMediaWikiUIEverywhere || $isVForm ) {
59 $chkLabelClass = $isCodexForm ?
'cdx-checkbox' :
'mw-ui-checkbox';
60 $chkLabel = Html::rawElement(
62 [
'class' => $chkLabelClass ],
78 if ( !empty( $this->mParams[
'invert'] ) ) {
86 $attr += OOUI\Element::configFromHtmlAttributes(
90 if ( $this->mClass !==
'' ) {
94 $attr[
'selected'] = $value;
97 return new OOUI\CheckboxInputWidget( $attr );
112 return $this->mLabel ??
'';
114 $this->mParent instanceof
HTMLForm &&
155 $invert = isset( $this->mParams[
'invert'] ) && $this->mParams[
'invert'];
160 if ( $this->
isSubmitAttempt( $request ) || $request->getCheck( $this->mName ) ) {
162 ? !$request->getBool( $this->mName )
163 : $request->getBool( $this->mName );
getLabel()
For a checkbox, the label goes on the right hand side, and is added in getInputHTML(),...
loadDataFromRequest( $request)
getInputHTML( $value)
This function must be implemented to return the HTML to generate the input object itself....
getLabelAlignOOUI()
Get label alignment when generating field for OOUI.
getInputOOUI( $value)
Get the OOUI version of this field.
needsLabel()
checkboxes don't need a label.
A class containing constants representing the names of configuration variables.
static check( $name, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox.