mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-12-18 00:20:37 +00:00
f9dcf46d70
Xml::buildForm and Xml::fieldset are left. Change-Id: Iff88869fd002165ec9ee80897d4deb585005b9d1
34 lines
744 B
PHP
34 lines
744 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\AbuseFilter\EditBox;
|
|
|
|
use MediaWiki\Html\Html;
|
|
|
|
/**
|
|
* Class responsible for building a plain text filter edit box
|
|
*/
|
|
class PlainEditBoxBuilder extends EditBoxBuilder {
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getEditBox( string $rules, bool $isUserAllowed, bool $externalForm ): string {
|
|
$rules = rtrim( $rules ) . "\n";
|
|
$editorAttribs = [
|
|
'name' => 'wpFilterRules',
|
|
'id' => 'wpFilterRules',
|
|
// Rules are in English
|
|
'dir' => 'ltr',
|
|
'cols' => 40,
|
|
'rows' => 15,
|
|
];
|
|
if ( !$isUserAllowed ) {
|
|
$editorAttribs['readonly'] = 'readonly';
|
|
}
|
|
if ( $externalForm ) {
|
|
$editorAttribs['form'] = 'wpFilterForm';
|
|
}
|
|
return Html::element( 'textarea', $editorAttribs, $rules );
|
|
}
|
|
|
|
}
|