As discovered in #1980822: Support any entity with path.module storage-related methods are not invoked for computed fields. Attached patch should fix it.

CommentFileSizeAuthor
d8_field_method_computed.patch796 bytesfago

Comments

fago’s picture

Issue tags: +Needs tests

As discussed with berdir, this could need test coverage and for that a computed-field test implementation.

sun’s picture

Status: Needs review » Reviewed & tested by the community

IMHO, #1980822: Support any entity with path.module will be sufficient for test coverage.

fago’s picture

d8_field_method_computed.patch queued for re-testing.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs tests

Committed a0fb280 and pushed to 8.x. Thanks!

yched’s picture

Ouch...
We advertize "foreach ($entity as $items)" as the new handy way to iterate over fields in an entity, but it seems easy to overlook that it skips computed fields.

Shouldn't it iterate on computed as well ?

yched’s picture

Oops, my previous comment had a typo that completely blurs it.
"Shouldn't it iterate on no computed as well ?" -> "Shouldn't it iterate on computed as well ?"
Edited it.

Status: Fixed » Closed (fixed)

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