Bug #89204
closedForm variants: Override ignored for arrays, if a value is removed
100%
Description
Take this SingleSelect as an example:
-
properties:
options:
'': '---'
mr: Mr.
mrs: Mrs.
miss: Miss
defaultValue: ''
type: SingleSelect
identifier: salulation
label: Salutation
variants:
-
identifier: salulation-variant
condition: 'siteLanguage("locale") == "zh_CN.utf-8"'
properties:
options:
'': '---'
mr: Mr.
mrs: Mrs.
In case of the specified variant, a single option item shall be removed from the select. This will be ignored.
The reason is the following code in AbstractFormElement.php:
/**
* Set a property of the element
*
* @param string $key
* @param mixed $value
*/
public function setProperty(string $key, $value)
{
if (is_array($value) && isset($this->properties[$key]) && is_array($this->properties[$key])) {
ArrayUtility::mergeRecursiveWithOverrule($this->properties[$key], $value);
$this->properties[$key] = ArrayUtility::removeNullValuesRecursive($this->properties[$key]);
} elseif ($value === null) {
unset($this->properties[$key]);
} else {
$this->properties[$key] = $value;
}
}
Overriding an array (in this case "options") will alway lead to an array_merge of the original and the new array. So as of now, you cannot remove an array item with the variants feature.
Updated by Gerrit Code Review about 5 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61764
Updated by Gerrit Code Review about 5 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61764
Updated by Christian Eßl about 5 years ago
- Target version set to Candidate for patchlevel
Updated by Gerrit Code Review almost 5 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61764
Updated by Gerrit Code Review almost 5 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61764
Updated by Gerrit Code Review almost 5 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61764
Updated by Gerrit Code Review almost 5 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61764
Updated by Gerrit Code Review almost 5 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62288
Updated by Christian Eßl almost 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 82c96c4388c1beaab4fac52fd4d9f559652a4288.
Updated by Gerrit Code Review almost 5 years ago
- Status changed from Resolved to Under Review
Patch set 2 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62288
Updated by Christian Eßl almost 5 years ago
- Status changed from Under Review to Resolved
Applied in changeset 8610cb09b1d40167ae68d7520c6bd3c3cecdebf8.
Updated by Benni Mack almost 5 years ago
- Status changed from Resolved to Closed