-
-
Save mainframe98/7da5a4849be7e159049e6e00025dcc45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( function ( mw, $, OO ) { | |
var field = OO.ui.infuse( 'checkfield-box-field' ), | |
toggleSwitch2 = new OO.ui.ToggleSwitchWidget( { | |
value: field.getValue() | |
} ); | |
// Create a FieldsetLayout to layout and label switches | |
var fieldset = new OO.ui.FieldsetLayout( { | |
label: 'Toggle switches' | |
} ); | |
fieldset.addItems( [ | |
new OO.ui.FieldLayout( toggleSwitch2, { label: 'On', align: 'top' } ) | |
] ); | |
$( '#checkfield-box-field' ).append( fieldset.$element ); | |
field.toggle(); | |
}( mediaWiki, jQuery, OO ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SpecialTest extends FormSpecialPage { | |
public function __construct() { | |
parent::__construct( 'Test' ); | |
} | |
/** | |
* Get an HTMLForm descriptor array | |
* @return array | |
*/ | |
protected function getFormFields() : array { | |
$this->getOutput()->addModules( 'ext.TestExtension' ); | |
return [ | |
'check' => [ | |
'type' => 'check', | |
'label' => 'check', | |
'id' => 'checkfield-box-field' | |
] | |
]; | |
} | |
/** | |
* Process the form on POST submission. | |
* @param array $data | |
* @param HTMLForm $form | |
* @return bool|string|array|Status As documented for HTMLForm::trySubmit. | |
*/ | |
public function onSubmit( array $data, HTMLForm $form = null ) { | |
wfVarDump( $data ); | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment