Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 30
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
InputFormPage
0.00% covered (danger)
0.00%
0 / 30
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 getHtml
0.00% covered (danger)
0.00%
0 / 30
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace FileImporter\Html;
4
5use MediaWiki\EditPage\EditPage;
6use MediaWiki\Html\Html;
7use OOUI\ButtonInputWidget;
8use OOUI\TextInputWidget;
9
10/**
11 * Page displaying a form for entering a URL to start an import.
12 *
13 * @license GPL-2.0-or-later
14 * @author Addshore
15 */
16class InputFormPage extends SpecialPageHtmlFragment {
17
18    public function getHtml(): string {
19        return Html::openElement( 'div' ) .
20            Html::openElement(
21                'form',
22                [
23                    'action' => $this->getPageTitle()->getLocalURL(),
24                    'method' => 'POST',
25                ]
26            ) .
27            Html::hidden( 'wpUnicodeCheck', EditPage::UNICODE_CHECK ) .
28            ( new HelpBanner( $this ) )->getHtml() .
29            new TextInputWidget(
30                [
31                    'name' => 'clientUrl',
32                    'autofocus' => true,
33                    'required' => true,
34                    'type' => 'url',
35                    'placeholder' => $this->msg( 'fileimporter-exampleprefix' )->plain() .
36                        ': https://en.wikipedia.org/wiki/File:Berlin_Skyline',
37                ]
38            ) .
39            new ButtonInputWidget(
40                [
41                    'classes' => [ 'mw-fileimporter-url-submit' ],
42                    'label' => $this->msg( 'fileimporter-submit' )->plain(),
43                    'type' => 'submit',
44                    'flags' => [ 'primary', 'progressive' ],
45                ]
46            ) .
47            Html::closeElement( 'form' ) .
48            Html::closeElement( 'div' );
49    }
50
51}