Problem/Motivation

The NameItem field item class does not override mainPropertyName() and thus returns 'value'. 'value' does not respond to a property on name field items so any code that makes use of getMainPropertyName() breaks or gives incorrect results.

One example of this is in CTools TypedDataRelationshipDeriver:

if ($main_property = $property_definition->getFieldStorageDefinition()->getMainPropertyName()) {
        if ($property_definition->getFieldStorageDefinition()->getPropertyDefinition($main_property)) {

Solution
Correctly override mainPropertyName to return NULL

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rlmumford created an issue. See original summary.

rlmumford’s picture

Title: NameItem::getMainPropertyName() returns 'value' which is not a property of the name field » NameItem::mainPropertyName() returns 'value' which is not a property of the name field
Status: Needs work » Needs review
FileSize
510 bytes

Patch does as stated in the issue summary

rlmumford’s picture

Assigned: rlmumford » Unassigned

Status: Needs review » Needs work

The last submitted patch, 2: 3054937-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

rlmumford’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: 3054937-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

rlmumford’s picture

Failures do not seem to be related to the patch?

rlmumford’s picture

Status: Needs work » Needs review

  • Alan D. committed 660c2b9 on 8.x-1.x authored by rlmumford
    Issue #3054937 by rlmumford, Alan D.: NameItem::mainPropertyName()...
Alan D.’s picture

Priority: Critical » Normal
Status: Needs review » Fixed

Failures do not seem to be related to the patch?

Correct

Pushed though, cheers

Status: Fixed » Closed (fixed)

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