diff options
author | Daimona Eaytoy <daimona.wiki@gmail.com> | 2021-12-17 23:26:45 +0100 |
---|---|---|
committer | MusikAnimal <musikanimal@gmail.com> | 2021-12-20 21:34:29 +0000 |
commit | 8fda40e95f5ce3c1107291073446d78c3ae74eed (patch) | |
tree | d515f4c334614f3546922e9221026fa69831e9db | |
parent | 55b37667550960ec796115f60538998c81268705 (diff) |
HTMLFormField: fix merging of condState attributes
Array addition in PHP does not renumber keys, so it can't be used to get
the union of two lists.
Bug: T297975
Change-Id: Ic9932b23e32c704b14fc9fe234c35a48b59767c5
-rw-r--r-- | includes/htmlform/HTMLFormField.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php index 7321284bb40c..64306460cabe 100644 --- a/includes/htmlform/HTMLFormField.php +++ b/includes/htmlform/HTMLFormField.php @@ -275,7 +275,7 @@ abstract class HTMLFormField { * @return bool */ public function isHidden( $alldata ) { - if ( $this->mCondState['class'] || !isset( $this->mCondState['hide'] ) ) { + if ( !$this->mCondState['class'] || !isset( $this->mCondState['hide'] ) ) { return false; } @@ -514,7 +514,7 @@ abstract class HTMLFormField { if ( $this->mCondState['class'] ) { $rowAttributes['data-cond-state'] = FormatJson::encode( $this->mCondState ); - $rowClasses = implode( ' ', $this->mCondState['class'] ); + $rowClasses .= implode( ' ', $this->mCondState['class'] ); } if ( $verticalLabel ) { @@ -579,7 +579,7 @@ abstract class HTMLFormField { ]; if ( $this->mCondState['class'] ) { $wrapperAttributes['data-cond-state'] = FormatJson::encode( $this->mCondState ); - $wrapperAttributes['class'] += $this->mCondState['class']; + $wrapperAttributes['class'] = array_merge( $wrapperAttributes['class'], $this->mCondState['class'] ); } $html = Html::rawElement( 'div', $wrapperAttributes, $label . $field ); $html .= $helptext; @@ -833,7 +833,7 @@ abstract class HTMLFormField { } if ( $this->mCondState['class'] ) { $wrapperAttributes['data-cond-state'] = FormatJson::encode( $this->mCondState ); - $wrapperAttributes['class'] += $this->mCondState['class']; + $wrapperAttributes['class'] = array_merge( $wrapperAttributes['class'], $this->mCondState['class'] ); } $div = Html::rawElement( 'div', $wrapperAttributes, $helptext ); |