Problem/Motivation
Currently there is no normalizer for viewsreference so null gets returned. In order to have proper json view returned a Normalizer needs to be created.
Proposed resolution
Create a normalizer for '\Drupal\viewsreference\Plugin\Field\FieldType\ViewsReferenceItem'
Remaining tasks
- Add validation
- Add documentation
- Add tests
I have included a patch for the base of the normalizer
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 2900315-3-normalizer.patch | 1.42 KB | bojan_dev |
| viewsreference.patch | 1.62 KB | nylsoo |
Comments
Comment #2
idebr commentedClosed #2913557: Provide normalizer/serializer support for the field type as a duplicate.
Comment #3
bojan_dev commentedNormalization was already working for the ViewsReferenceItem due it's parent EntityReferenceItem, the only thing that wasn't yet working was the denormalizer, it was only setting the target_id value and was missing the additional viewsreference properties (display_id and data). So by just returning all the properties in the constructValue we are good to go.
Comment #4
ralphvdhoudt commentedThe patch works as advertised
Comment #6
seanbLooks good, thanks! Committed and will roll a new release soon.
Comment #7
seanbComment #8
jberube commentedI just upgraded from alpha4 to alpha5, and I get fatal error on any page, or on a cache clear.
or if I do updb:
Comment #9
reevo commented@jberube, see related issue for workarounds: #3096956: Updating from alpha4 to alpha5 via composer results in error