36 'fieldname' =>
$params[
'fieldname'] .
'-ip',
37 'rows' => self::DEFAULT_ROWS,
38 'required' =>
$params[
'required'] ??
false,
39 'help-message' =>
'restrictionsfield-help',
40 'label-message' =>
'restrictionsfield-label',
47 'fieldname' =>
$params[
'fieldname'] .
'-pages',
48 'label-message' =>
'restrictionsfields-pages-label',
49 'help-message' =>
'restrictionsfields-pages-help',
50 'allowArbitrary' =>
true,
61 if ( !$request->getCheck( $this->mName .
'-ip' ) ) {
65 $ipValue = rtrim( $request->getText( $this->mName .
'-ip' ),
"\r\n" );
66 $ips = $ipValue ===
'' ? [] : explode(
"\n", $ipValue );
67 $pagesValue = $request->getText( $this->mName .
'-pages' );
68 $pageList = $pagesValue ? explode(
"\n", $pagesValue ) : [];
92 isset( $this->mParams[
'required'] ) && $this->mParams[
'required'] !==
false
93 && !$value->toArray()[
'IPAddresses']
95 return $this->
msg(
'htmlform-required' );
98 if ( !$value->validity->isGood() ) {
100 $this->mParent->getContext()
102 return $statusFormatter->getMessage( $value->validity );
105 if ( isset( $this->mValidationCallback ) ) {
106 return call_user_func( $this->mValidationCallback, $value, $alldata, $this->mParent );
117 $ipValue = implode(
"\n", $value->toArray()[
'IPAddresses'] );
118 $pagesValue = implode(
"\n", $value->toArray()[
'Pages'] ?? [] );
120 $this->ipField->getDiv( $ipValue ) .
121 $this->pagesField->getDiv( $pagesValue )
131 $ipValue = implode(
"\n", $value->toArray()[
'IPAddresses'] );
132 $pagesValue = implode(
"\n", $value->toArray()[
'Pages'] ?? [] );
134 $this->ipField->getOOUI( $ipValue ) .
135 $this->pagesField->getOOUI( $pagesValue )
141class_alias( HTMLRestrictionsField::class,
'HTMLRestrictionsField' );
array $params
The job parameters.
A class to check request restrictions expressed as a JSON object.
static newFromArray(array $restrictions)