Problem/Motivation

When saving an entity including an address field, the structure of the value contained in the original entity differs from the structure of the value of the saved entity. If you try to use \Drupal\Core\Field\FieldItemListInterface::equals() on an address field, you always get a FALSE return even if the user didn't change anything.

Proposed resolution

Implement the getValue() method on \Drupal\address\Plugin\Field\FieldType\AddressItem to filter the results so the empty keys are not retreived.

Remaining tasks

Patch, Review, Commit

User interface changes

None.

API changes

Addition of the public \Drupal\address\Plugin\Field\FieldType\AddressItem::getValue() method.

Data model changes

None.

CommentFileSizeAuthor
#2 address-filter_value_keys-2839470-2.patch552 bytesduaelfr

Comments

DuaelFr created an issue. See original summary.

duaelfr’s picture

Status: Active » Needs review
StatusFileSize
new552 bytes
bojanz’s picture

I don't understand why this is needed. Why would you not want to compare fields with empty values? If two addresses both have an empty second address line, that should not influence the comparison?

bojanz’s picture

Status: Needs review » Closed (won't fix)

No clarification given.