Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| AddKeyLayout | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| getInputHTML | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\OATHAuth\HTMLField; |
| 4 | |
| 5 | use MediaWiki\HTMLForm\HTMLFormField; |
| 6 | use OOUI\ActionFieldLayout; |
| 7 | use OOUI\ButtonWidget; |
| 8 | use OOUI\TextInputWidget; |
| 9 | |
| 10 | class AddKeyLayout extends HTMLFormField { |
| 11 | |
| 12 | /** |
| 13 | * @param string $value |
| 14 | * @return string The ActionFieldLayout, stringified |
| 15 | */ |
| 16 | public function getInputHTML( $value ) { |
| 17 | // We initiate the fields disabled, to avoid user interacting |
| 18 | // with the form, until the client-side script is loaded and ready |
| 19 | $input = new TextInputWidget( [ |
| 20 | 'id' => 'key_name', |
| 21 | 'name' => 'key_name', |
| 22 | 'required' => false, |
| 23 | 'infusable' => true, |
| 24 | 'disabled' => true, |
| 25 | 'autofocus' => true, |
| 26 | ] ); |
| 27 | $button = new ButtonWidget( [ |
| 28 | 'flags' => [ 'primary', 'progressive' ], |
| 29 | 'label' => wfMessage( 'oathauth-webauthn-ui-add-key' )->plain(), |
| 30 | 'disabled' => true, |
| 31 | 'id' => 'button_add_key', |
| 32 | 'infusable' => true |
| 33 | ] ); |
| 34 | return (string)new ActionFieldLayout( $input, $button ); |
| 35 | } |
| 36 | } |