Bug #65073
SelectViewHelper doesn't handle optionValueField and optionLabelField for array options
Status: | Needs Feedback | Start date: | 2015-02-14 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Alexander Schnitzler | % Done: | 100% |
|
Category: | Fluid | Spent time: | - | |
Target version: | 7.4 (Backend) | |||
TYPO3 Version: | 7 | Is Regression: | No | |
PHP Version: | Sprint Focus: | |||
Complexity: | easy |
Description
<f:form.select options="{array}" optionValueField="uid" optionLabelField="title" />
should work with the given array:
array( array( 'uid' => 1, 'title' => 'Foo' ), array( 'uid' => -1, 'title' => 'Bar' ), array( 'title' => 'Baz' ), array( 'uid' => '2' ), )
Currently fluid tries to use the keys as values and the arrays as label which results in an error.
Related issues
Associated revisions
[BUGFIX] SelectViewHelper must respect option(Value|Label)Field for arrays
The SelectViewHelper tries to resolve the value and label
field as long as options are of type object, i.e. domain
objects but that functionality must also exist for arrays
because their structure is similar to objects.
Example:
<f:form.select
options="{items}"
optionValueField="uid"
optionLabelField="title"
/>
$items = array(
0 => array(
'uid' => 1,
'title' => 'Foo'
),
);
Currently the view helper tries to use the array key as
value field (i.e. 0) and the array value (i.e. array) as
label and fails calling htmlspecialchars on the array.
This patch allows values to be arrays themselves and to
be treated like domain objects.
Resolves: #65073
Releases: master, 6.2
Change-Id: Ia803ceb38c1f7488d48863f5a6781b229def50c4
Reviewed-on: http://review.typo3.org/36909
Reviewed-by: Stefan Froemken <froemken@gmail.com>
Tested-by: Stefan Froemken <froemken@gmail.com>
Tested-by: Andy Grunwald <andygrunwald@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
[BUGFIX] SelectViewHelper must respect option(Value|Label)Field for arrays
The SelectViewHelper tries to resolve the value and label
field as long as options are of type object, i.e. domain
objects but that functionality must also exist for arrays
because their structure is similar to objects.
Example:
<f:form.select
options="{items}"
optionValueField="uid"
optionLabelField="title"
/>
$items = array(
0 => array(
'uid' => 1,
'title' => 'Foo'
),
);
Currently the view helper tries to use the array key as
value field (i.e. 0) and the array value (i.e. array) as
label and fails calling htmlspecialchars on the array.
This patch allows values to be arrays themselves and to
be treated like domain objects.
Resolves: #65073
Releases: master, 6.2
Change-Id: Ia803ceb38c1f7488d48863f5a6781b229def50c4
Reviewed-on: http://review.typo3.org/37376
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
History
#1 Updated by Gerrit Code Review 6 months 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 http://review.typo3.org/36909
#2 Updated by Gerrit Code Review 5 months ago
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37376
#3 Updated by Anonymous 5 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 968ed7f4420b67e0811ef2126a8504cce44a8a6b.
#4 Updated by Stefan Neufeind 5 months ago
Also created an issue upstream at Flow-Fluid, #65424.
#5 Updated by Gerrit Code Review 5 months ago
- Status changed from Resolved 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 http://review.typo3.org/37504
#6 Updated by Marcus Schwemer 5 months ago
Hi,
this breaks the current behavious as stated in post-verifies on Gerrit https://review.typo3.org/#/c/36909/
Another report is for powermail: #65792
IMO this change should be done in a non-breaking way or should be reverted.
Kind regards,
Marcus
#7 Updated by Benjamin Mack about 1 month ago
- Target version changed from 7.1 (Cleanup) to 7.4 (Backend)
#8 Updated by Wouter Wolters 23 days ago
- Status changed from Under Review to Needs Feedback
Still something needed here? The patch is abandoned.