Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 19 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| RegisteredKeyLayout | |
0.00% |
0 / 19 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| getInputHTML | |
0.00% |
0 / 19 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\OATHAuth\HTMLField; |
| 4 | |
| 5 | use MediaWiki\Html\Html; |
| 6 | use MediaWiki\HTMLForm\HTMLFormField; |
| 7 | use OOUI\ButtonInputWidget; |
| 8 | use OOUI\HorizontalLayout; |
| 9 | use OOUI\HtmlSnippet; |
| 10 | use OOUI\LabelWidget; |
| 11 | |
| 12 | class RegisteredKeyLayout extends HTMLFormField { |
| 13 | |
| 14 | /** |
| 15 | * @param array $value |
| 16 | * @return string The HorizontalLayout, stringified |
| 17 | */ |
| 18 | public function getInputHTML( $value ) { |
| 19 | $nameValue = $value['name']; |
| 20 | |
| 21 | $name = new LabelWidget( [ |
| 22 | 'label' => new HtmlSnippet( Html::element( 'b', [], $nameValue ) ) |
| 23 | ] ); |
| 24 | $removeButton = new ButtonInputWidget( [ |
| 25 | 'framed' => false, |
| 26 | 'flags' => [ 'primary', 'progressive' ], |
| 27 | 'label' => wfMessage( 'oathauth-webauthn-ui-remove-key' )->plain(), |
| 28 | 'classes' => [ 'removeButton' ], |
| 29 | 'disabled' => true, |
| 30 | 'value' => $nameValue, |
| 31 | 'infusable' => true |
| 32 | ] ); |
| 33 | |
| 34 | return (string)new HorizontalLayout( [ |
| 35 | 'classes' => [ 'webauthn-key-layout' ], |
| 36 | 'items' => [ |
| 37 | $name, $removeButton |
| 38 | ] |
| 39 | ] ); |
| 40 | } |
| 41 | } |