X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fhtmlform%2Ffields%2FHTMLMultiSelectField.php;h=2038606597d20adbfa6f0e034061aeb819480eef;hb=098fd0dcb34cca4a3d11059e0d6a7d4861124d98;hp=e8a7e992caf81ca1110b633f4f0688b017b7394c;hpb=803f3867b7fcbb5fcee405f5c10cfa06cb857bd6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/htmlform/fields/HTMLMultiSelectField.php b/includes/htmlform/fields/HTMLMultiSelectField.php index e8a7e992ca..2038606597 100644 --- a/includes/htmlform/fields/HTMLMultiSelectField.php +++ b/includes/htmlform/fields/HTMLMultiSelectField.php @@ -105,7 +105,7 @@ class HTMLMultiSelectField extends HTMLFormField implements HTMLNestedFilterable $elementFunc = [ Html::class, $this->mOptionsLabelsNotFromMessage ? 'rawElement' : 'element' ]; $checkbox = Xml::check( "{$this->mName}[]", $checked, $attribs ) . - ' ' . + "\u{00A0}" . call_user_func( $elementFunc, 'label', [ 'for' => $attribs['id'] ], @@ -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();