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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

morsok created an issue. See original summary.

morsok’s picture

Status: Active » Needs review
FileSize
544 bytes

Here is a simple patch.

Status: Needs review » Needs work

The last submitted patch, 2: declare_the_main-2701933-2.patch, failed testing.

morsok’s picture

Status: Needs work » Needs review

(putting back to needs review, the test fails because there is no tests in the module repo)

hctom’s picture

Status: Needs review » Reviewed & tested by the community

Patch from #2 works perfectly for me.

NickDickinsonWilde’s picture

Status: Reviewed & tested by the community » Fixed

Not surprisingly, after 2 years, this needed a reroll. Actually, probably only needed a reroll for today. But anways, thanks for the patch!
Committed.

  • NickWilde committed ddce0a3 on 8.x-2.x authored by morsok
    Issue #2701933 by morsok: Declare the main property name
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.