Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
You need to declare the main property of the field by overriding the mainPropertyName method since it's default is 'value' and there is no 'value' in the schema.
without that it causes bug sometimes when you try to get the value (like with getFieldValue in a views).
Related is a core patch that makes views use this to properly get the raw value of the view field.
Proposed resolution
Override the method and set 'color' as the main property.
Remaining tasks
Test the patch.
User interface changes
NONE
API changes
NONE
Data model changes
NONE
Comment | File | Size | Author |
---|---|---|---|
#2 | declare_the_main-2701933-2.patch | 544 bytes | morsok |
|
Comments
Comment #2
morsokHere is a simple patch.
Comment #4
morsok(putting back to needs review, the test fails because there is no tests in the module repo)
Comment #5
hctomPatch from #2 works perfectly for me.
Comment #6
NickDickinsonWildeNot surprisingly, after 2 years, this needed a reroll. Actually, probably only needed a reroll for today. But anways, thanks for the patch!
Committed.