];
$fields['restrictions'] = [
- 'type' => 'textarea',
- 'label-message' => 'botpasswords-label-restrictions',
+ 'class' => 'HTMLRestrictionsField',
'required' => true,
- 'default' => $this->botPassword->getRestrictions()->toJson( true ),
- 'rows' => 5,
- 'validation-callback' => function ( $v ) {
- try {
- MWRestrictions::newFromJson( $v );
- return true;
- } catch ( InvalidArgumentException $ex ) {
- return $ex->getMessage();
- }
- },
+ 'default' => $this->botPassword->getRestrictions(),
];
} else {
'name' => 'op',
'value' => 'create',
'label-message' => 'botpasswords-label-create',
- 'flags' => [ 'primary', 'constructive' ],
+ 'flags' => [ 'primary', 'progressive' ],
] );
}
$bp = BotPassword::newUnsaved( [
'centralId' => $this->userId,
'appId' => $this->par,
- 'restrictions' => MWRestrictions::newFromJson( $data['restrictions'] ),
+ 'restrictions' => $data['restrictions'],
'grants' => array_merge(
MWGrants::getHiddenGrants(),
preg_replace( '/^grant-/', '', $data['grants'] )