Merge "HTMLMultiSelectField: Add forced-on options to the output of filter"

This commit is contained in:
jenkins-bot 2022-02-09 19:53:08 +00:00 committed by Gerrit Code Review
commit 499f36d60f

View file

@ -292,10 +292,11 @@ class HTMLMultiSelectField extends HTMLFormField implements HTMLNestedFilterable
public function filterDataForSubmit( $data ) {
$data = HTMLFormField::forceToStringRecursive( $data );
$options = HTMLFormField::flattenOptions( $this->getOptions() );
$forcedOn = array_intersect( $this->mParams['disabled-options'], $this->getDefault() );
$res = [];
foreach ( $options as $opt ) {
$res["$opt"] = in_array( $opt, $data, true );
$res["$opt"] = in_array( $opt, $forcedOn, true ) || in_array( $opt, $data, true );
}
return $res;