Problem/Motivation
When the user has no access to field content the Twig field value module produces an empty array. This is usually no problem, but when working with multiple values, this may result in unwanted behavior. For example we make a comma separated list of node labels from an entity reference field: "One, Two, Three. When node "Two" is unpublished, the list will become: "One, ,Three"
Proposed resolution
The field_value filter should retrieve the field delta from the render array of the formatter and not from the FieldItemList.
Remaining tasks
Tests. Maybe we KernelTest that has access checks.
API changes
none
Comments
Comment #2
webflo commentedComment #3
webflo commentedComment #5
webflo commentedComment #6
webflo commentedPatch + Test
Comment #8
webflo commentedComment #9
sutharsan commentedOh, great! I tried to add a test this afternoon but I failed.
Comment #10
webflo commented::getVisibleChildren is not really necessary. The render api uses ::children is most cases.
Comment #11
sutharsan commentedComment #12
heine commentedComment #13
heine commentedRepublishing on request.
Comment #14
sutharsan commentedUpdating title and issue summary to accurately describe the issue.
Comment #16
sutharsan commented