X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fhtmlform%2Ffields%2FHTMLMultiSelectField.php;h=2038606597d20adbfa6f0e034061aeb819480eef;hb=098fd0dcb34cca4a3d11059e0d6a7d4861124d98;hp=4b1bc552bb1b2b7732d06043a931a23356ec0a39;hpb=2f1e5a8d22d7c005e72f8bdb732e6d7076ac3344;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/htmlform/fields/HTMLMultiSelectField.php b/includes/htmlform/fields/HTMLMultiSelectField.php index 4b1bc552bb..2038606597 100644 --- a/includes/htmlform/fields/HTMLMultiSelectField.php +++ b/includes/htmlform/fields/HTMLMultiSelectField.php @@ -214,10 +214,14 @@ class HTMLMultiSelectField extends HTMLFormField implements HTMLNestedFilterable * @return string|array */ public function loadDataFromRequest( $request ) { - if ( $this->isSubmitAttempt( $request ) ) { + $fromRequest = $request->getArray( $this->mName, [] ); + // Fetch the value in either one of the two following case: + // - we have a valid submit attempt (form was just submitted) + // - we have a value (an URL manually built by the user, or GET form with no wpFormIdentifier) + if ( $this->isSubmitAttempt( $request ) || $fromRequest ) { // Checkboxes are just not added to the request arrays if they're not checked, // so it's perfectly possible for there not to be an entry at all - return $request->getArray( $this->mName, [] ); + return $fromRequest; } else { // That's ok, the user has not yet submitted the form, so show the defaults return $this->getDefault();