Problem/Motivation
The "Display all values in the same row" setting for the "Multiple field settings" field plugin settings doesn't work properly for views REST displays. All fields are printed for each row instead of one per row when the option is unchecked.
Reproduction
- Start from the Standard installation profile.
- Set the cardinality field of the image field on article to unlimited
- Create some article nodes with multiple images
- Enable the "RESTful Web Services" module
- Create a new view with a "REST export" display
- Set row display to fields
- Add the image field and uncheck the "Display all values in the same row" checkbox
Actual Result
[
{
"title": "pretium a ipsum et; sodales",
"images": " <img src=\"https://dfrkb.ply.st/sites/default/files/field/image/600x300.png\" width=\"600\" height=\"300\" alt=\"Nullam scelerisque enim nec arcu dapibus mollis. Vestibulum soda.\" typeof=\"foaf:Image\" />\n\n, <img src=\"https://dfrkb.ply.st/sites/default/files/field/image/600x300_0.png\" width=\"600\" height=\"300\" alt=\"arcu dapibus mollis. Vestibulum soda.\" typeof=\"foaf:Image\" />\n\n"
},
{
"title": "pretium a ipsum et; sodales",
"images": " <img src=\"https://dfrkb.ply.st/sites/default/files/field/image/600x300.png\" width=\"600\" height=\"300\" alt=\"Nullam scelerisque enim nec arcu dapibus mollis. Vestibulum soda.\" typeof=\"foaf:Image\" />\n\n, <img src=\"https://dfrkb.ply.st/sites/default/files/field/image/600x300_0.png\" width=\"600\" height=\"300\" alt=\"arcu dapibus mollis. Vestibulum soda.\" typeof=\"foaf:Image\" />\n\n"
}
]
Expected Result
[
{
"title": "pretium a ipsum et; sodales",
"images": " <img src=\"https://dfrkb.ply.st/sites/default/files/field/image/600x300.png\" width=\"600\" height=\"300\" alt=\"Nullam scelerisque enim nec arcu dapibus mollis. Vestibulum soda.\" typeof=\"foaf:Image\" />\n\n"
},
{
"title": "pretium a ipsum et; sodales",
"images": " <img src=\"https://dfrkb.ply.st/sites/default/files/field/image/600x300_0.png\" width=\"600\" height=\"300\" alt=\"arcu dapibus mollis. Vestibulum soda.\" typeof=\"foaf:Image\" />\n\n"
}
]
Proposed resolution
Add a test to check if the setting is being honored. Debug and fix the output.
Remaining tasks
Debug and fix.
User interface changes
none
API changes
none
Data model changes
none
Comments
Comment #2
geertvd commentedI can reproduce this issue, updated the IS with steps to reproduce that describe the problem better.
Comment #3
geertvd commentedComment #4
geertvd commentedComment #5
geertvd commentedThis fixes that, still needs tests though, will work on that now.
Comment #6
geertvd commentedComment #7
geertvd commentedAdded tests
Comment #8
geertvd commentedComment #9
geertvd commentedComment #10
geertvd commentedComment #12
dawehnerNice work! The fix looks perfect for me, just curious whether this fixes the actual problem of @Jaesin
Comment #13
Jaesin commentedNice work indeed.
The results were as expected:
The results were as expected:
Comment #14
Jaesin commentedThis is just a re-roll because of #2557519: Remove many usages SafeMarkup::checkPlain() and replace with Html::escape(). No changes at all.
Comment #16
geertvd commented