Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
PlainEditBoxBuilder
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
12
0.00% covered (danger)
0.00%
0 / 1
 getEditBox
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2
3namespace MediaWiki\Extension\AbuseFilter\EditBox;
4
5use MediaWiki\Html\Html;
6
7/**
8 * Class responsible for building a plain text filter edit box
9 */
10class PlainEditBoxBuilder extends EditBoxBuilder {
11    /**
12     * @inheritDoc
13     */
14    public function getEditBox( string $rules, bool $isUserAllowed, bool $externalForm ): string {
15        $rules = rtrim( $rules ) . "\n";
16        $editorAttribs = [
17            'name' => 'wpFilterRules',
18            'id' => 'wpFilterRules',
19            // Rules are in English
20            'dir' => 'ltr',
21            'cols' => 40,
22            'rows' => 15,
23        ];
24        if ( !$isUserAllowed ) {
25            $editorAttribs['readonly'] = 'readonly';
26        }
27        if ( $externalForm ) {
28            $editorAttribs['form'] = 'wpFilterForm';
29        }
30        return Html::element( 'textarea', $editorAttribs, $rules );
31    }
32
33}