Problem/Motivation
When configuring a view that concerns a field that allows multiple values, unchecking the Display all values in the same row checkbox under the field settings results in each value getting a row of its own. However, each row displays all values.
To reproduce
- Edit the Article content type's image field storage to allow unlimited values
- Create a view containing article title, and the image field.
- Under the image field settings in the view, expand the Multiple field settings
- Uncheck the Display all values in the same row
Note that now each node gets a row for each image (as it should). However, instead of displaying only one image per row, all images are displayed in each row.
Note that this is not specific to image fields ( I also tested with integer list fields), nor does it appear to be specific to the display type selected.
Proposed resolution
Each row should only display one value in a multiple value field configuration.
Remaining tasks
Fix the issue.
User interface changes
API changes
Beta phase evaluation
Issue category | Bug because multiple value field views are not working as expected |
---|---|
Unfrozen changes | Unfrozen because it only changes multiple value field views to work as they previously did |
Comment | File | Size | Author |
---|---|---|---|
#33 | 2397495-33-complete.patch | 7.13 KB | geertvd |
#33 | 2397495-33-tests.patch | 5.86 KB | geertvd |
#29 | 2397495-29-complete.patch | 7.13 KB | geertvd |
#29 | 2397495-29-tests.patch | 5.86 KB | geertvd |
#24 | 2397495-24-complete.patch | 11.11 KB | geertvd |
Comments
Comment #1
dawehnerurgs
Comment #2
jhedstromComment #3
dawehnerTotally agree that this sounds like a bug we have to fix.
Comment #4
geertvd CreditAttribution: geertvd commentedThis fixed it for me.
Although I'm not sure what they are trying to do there, in #1758616: Implement core handling for limiting displayed deltas they are actually talking about moving this logic to the field formatter so maybe this one should be marked as a duplicate instead.
Comment #5
dawehnerThank you for the patch!
Let's first see whether this breaks other things.
In general we really need tests to ensure that things don't break anymore in the future.
Comment #6
geertvd CreditAttribution: geertvd commentedAdded the test, first time I'm writing one of these, hopefully it's somewhat correct.
Comment #7
geertvd CreditAttribution: geertvd commentedfixed, wrong issue id in filename
Comment #8
jhedstrom@geertvd could you upload the test as a separate file so the current failing behavior can be illustrated?
Comment #9
geertvd CreditAttribution: geertvd commentedHere you go
Comment #11
jhedstromThanks! Back to needs review as the test in #9 was expected to fail.
Need a line break here.
Those comments should have a period at the end. This is technically testing 'ungrouped' rows. Perhaps we should also add a test that checks the single-row (grouping) of multiple-value fields?
Comment #12
geertvd CreditAttribution: geertvd commentedGood point, added the second test and fixed some of the code formatting issues.
Comment #14
dawehnerI'd be great to move this at least into the handlers test namespace and prefix the class with Field so its more clear what this is about.
it would be great to document them + camelcase them :(
Comment #15
dawehnerThis fixes failures of #2342045: Standard views base fields need to use same rendering as Field UI fields, for formatting, access checking, and translation consistency so let's bump this to critical and for itself this is pretty WTF that it doesn't work (so for itself I would argue this is major)
Comment #16
dawehner.
Comment #17
geertvd CreditAttribution: geertvd commentedComment #20
geertvd CreditAttribution: geertvd commentedThis one should apply
Comment #21
geertvd CreditAttribution: geertvd commentedComment #22
dawehnerThis looks really fine!
I would have created just one test view and manipulated the checkbox manually in code, but having two exported views is fine.
Here are two left nitpicks!
Ensure that we point to the right classname in the documentation here :) (got confused for a while ... ). When you change this already use "Contains \Drupal...."
Can we put an @see \Drupal\views\Plugin\views\field\Field in here? This would help with understand where this setting is coming from.
you could change it to use "public ..."
Comment #24
geertvd CreditAttribution: geertvd commentedFixed those small issues.
Comment #25
dawehnerThank you!
Comment #27
alexpottI think this would be a better test if there was only one view and one test method - but the test just changes the
group_rows
value. Also an assertion difference betweenarray('a, b, c')
andarray('a', 'b', 'c')
is not that easy to spot. Maybe adding an assertion about the number of rows would make the distinction easier to spot.Comment #28
Risha CreditAttribution: Risha commentedThere is a same problem for drupal 7 views module, how could this patch be applied to the views version for drupal 7?
Comment #29
geertvd CreditAttribution: geertvd commentedI removed the second view and changed the
group_rows
value in the test.I also moved both scenarios in 1 test method and changed the way I'm handling assertions a bit.
Comment #30
geertvd CreditAttribution: geertvd commentedComment #32
dawehnerLet's start with a upper character :(
This is indeed way more readable!
Comment #33
geertvd CreditAttribution: geertvd commentedStart comments with uppercase
Comment #34
dawehnerThank you!
@geertvd
Feel free to include interdiffs (see https://www.drupal.org/documentation/git/interdiff ) in more core patches you do :)
Comment #36
alexpottThat's turned out really nice - thanks @geertvd. Committed 38b7427 and pushed to 8.0.x. Thanks!
Thank you for adding the beta evaluation to the summary.
On commit I removed the new line between the @param docs since it shouldn't be there.
Comment #39
ojchris CreditAttribution: ojchris as a volunteer and commentedInteresting that this bug has returned in Drupal 8.