aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjdlrobson <jdlrobson@gmail.com>2021-02-17 13:16:05 -0800
committerBartosz DziewoƄski <matma.rex@gmail.com>2021-02-19 01:17:02 +0100
commit20db32143b2a70a2710fd01324bceb5328c5c92c (patch)
tree1e7b58b1622e63be4267daaaf45d713edfb18164
parent17d5dc6d8afd2f03d33c1025e57019de1bb0108d (diff)
downloadmediawikicore-20db32143b2a70a2710fd01324bceb5328c5c92c.tar.gz
mediawikicore-20db32143b2a70a2710fd01324bceb5328c5c92c.zip
field descriptors in HTMLForm must have keys
Use the name of the input for the value where possible. Additional change: Use `default` rather than `invert` for checkbox default state. Bug: T275018 Bug: T274980 Change-Id: Ie08b192ad4967ac6c6d80b9c76224acd183fc1e8
-rw-r--r--includes/ProtectionForm.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php
index e961f2b3f428..d9c5256b9967 100644
--- a/includes/ProtectionForm.php
+++ b/includes/ProtectionForm.php
@@ -424,7 +424,7 @@ class ProtectionForm {
$options[$this->getOptionLabel( $key )] = $key;
}
- $fields[] = [
+ $fields[$id] = [
'type' => 'select',
'name' => $id,
'default' => $selected,
@@ -465,7 +465,7 @@ class ProtectionForm {
}
# Add expiry dropdown
- $fields[] = [
+ $fields["wpProtectExpirySelection-$action"] = [
'type' => 'select',
'name' => "wpProtectExpirySelection-$action",
'id' => "mwProtectExpirySelection-$action",
@@ -479,7 +479,7 @@ class ProtectionForm {
# Add custom expiry field
if ( !$this->disabled ) {
- $fields[] = [
+ $fields["mwProtect-expiry-$action"] = [
'type' => 'text',
'label' => $this->mContext->msg( 'protect-othertime' )->text(),
'name' => "mwProtect-expiry-$action",
@@ -504,7 +504,7 @@ class ProtectionForm {
# Add raw sections added in buildForm
if ( $hookFormRaw ) {
- $fields[] = [
+ $fields['rawinfo'] = [
'type' => 'info',
'default' => $hookFormRaw,
'raw' => true,
@@ -514,7 +514,7 @@ class ProtectionForm {
# JavaScript will add another row with a value-chaining checkbox
if ( $this->mTitle->exists() ) {
- $fields[] = [
+ $fields['mwProtect-cascade'] = [
'type' => 'check',
'label' => $this->mContext->msg( 'protect-cascade' )->text(),
'id' => 'mwProtect-cascade',
@@ -532,7 +532,7 @@ class ProtectionForm {
// Subtract arbitrary 75 to leave some space for the autogenerated null edit's summary
// and other texts chosen by dropdown menus on this page.
$maxlength = CommentStore::COMMENT_CHARACTER_LIMIT - 75;
- $fields[] = [
+ $fields['wpProtectReasonSelection'] = [
'type' => 'select',
'cssclass' => 'mwProtect-reason',
'label' => $this->mContext->msg( 'protectcomment' )->text(),
@@ -546,7 +546,7 @@ class ProtectionForm {
),
'default' => $this->mReasonSelection,
];
- $fields[] = [
+ $fields['mwProtect-reason'] = [
'type' => 'text',
'id' => 'mwProtect-reason',
'label' => $this->mContext->msg( 'protect-otherreason' )->text(),
@@ -557,12 +557,12 @@ class ProtectionForm {
];
# Disallow watching if user is not logged in
if ( $this->mUser->isRegistered() ) {
- $fields[] = [
+ $fields['mwProtectWatch'] = [
'type' => 'check',
'id' => 'mwProtectWatch',
'label' => $this->mContext->msg( 'watchthis' )->text(),
'name' => 'mwProtectWatch',
- 'invert' => !(
+ 'default' => (
$this->mUser->isWatched( $this->mTitle )
|| $this->mUser->getOption( 'watchdefault' )
),
@@ -582,7 +582,7 @@ class ProtectionForm {
}
if ( !$this->disabled ) {
- $fields[] = [
+ $fields['wpEditToken'] = [
'name' => 'wpEditToken',
'type' => 'hidden',
'default' => $this->mUser->getEditToken( [ 'protect', $this->mTitle->getPrefixedDBkey() ] ),