- $a = [
- 'Target' => [
- 'type' => 'user',
- 'ipallowed' => true,
- 'iprange' => true,
- 'label-message' => 'ipaddressorusername',
- 'id' => 'mw-bi-target',
- 'size' => '45',
- 'autofocus' => true,
- 'required' => true,
- 'validation-callback' => [ __CLASS__, 'validateTargetField' ],
- ],
- 'Expiry' => [
- 'type' => 'expiry',
- 'label-message' => 'ipbexpiry',
- 'required' => true,
- 'options' => $suggestedDurations,
- 'default' => $this->msg( 'ipb-default-expiry' )->inContentLanguage()->text(),
- ],
- 'Reason' => [
- 'type' => 'selectandother',
- // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
- // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
- // Unicode codepoints (or 255 UTF-8 bytes for old schema).
- 'maxlength' => $oldCommentSchema ? 255 : CommentStore::COMMENT_CHARACTER_LIMIT,
- 'maxlength-unit' => 'codepoints',
- 'label-message' => 'ipbreason',
- 'options-message' => 'ipbreason-dropdown',
- ],
- 'CreateAccount' => [
- 'type' => 'check',
- 'label-message' => 'ipbcreateaccount',
- 'default' => true,
- ],
+ $a = [];
+
+ $a['Target'] = [
+ 'type' => 'user',
+ 'ipallowed' => true,
+ 'iprange' => true,
+ 'label-message' => 'ipaddressorusername',
+ 'id' => 'mw-bi-target',
+ 'size' => '45',
+ 'autofocus' => true,
+ 'required' => true,
+ 'validation-callback' => [ __CLASS__, 'validateTargetField' ],
+ ];
+
+ if ( $enablePartialBlocks ) {
+ $a['EditingRestriction'] = [
+ 'type' => 'radio',
+ 'label' => $this->msg( 'ipb-type-label' )->text(),
+ 'options' => [
+ $this->msg( 'ipb-sitewide' )->text() => 'sitewide',
+ $this->msg( 'ipb-partial' )->text() => 'partial',
+ ],
+ ];
+ $a['PageRestrictions'] = [
+ 'type' => 'titlesmultiselect',
+ 'label' => $this->msg( 'ipb-pages-label' )->text(),
+ 'exists' => true,
+ 'max' => 10,
+ 'cssclass' => 'mw-block-page-restrictions',
+ ];
+ }
+
+ $a['Expiry'] = [
+ 'type' => 'expiry',
+ 'label-message' => 'ipbexpiry',
+ 'required' => true,
+ 'options' => $suggestedDurations,
+ 'default' => $this->msg( 'ipb-default-expiry' )->inContentLanguage()->text(),
+ ];
+
+ $a['Reason'] = [
+ 'type' => 'selectandother',
+ // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
+ // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
+ // Unicode codepoints (or 255 UTF-8 bytes for old schema).
+ 'maxlength' => $oldCommentSchema ? 255 : CommentStore::COMMENT_CHARACTER_LIMIT,
+ 'maxlength-unit' => 'codepoints',
+ 'label-message' => 'ipbreason',
+ 'options-message' => 'ipbreason-dropdown',
+ ];
+
+ $a['CreateAccount'] = [
+ 'type' => 'check',
+ 'label-message' => 'ipbcreateaccount',
+ 'default' => true,