I ran into this problem in a use case where I have two field collection fields on the same content type, and implemented hook_field_collection_is_empty alter for both of theses fields. For each field I get field values from the unsaved field collection entity using field_get_items, but for the second field collection field_get_items always returns FALSE. I tracked this down to a static cache in function field_language, where the entity $id is used as key. The fix is not pretty, but at least small and unobtrusive, and can impossibly cause any other issues since it in effect only disables the cache for this "special" case.

CommentFileSizeAuthor
#3 2688363-2.patch781 bytesgnucifer
#2 2688363-1.patch844 bytesgnucifer

Comments

gnucifer created an issue. See original summary.

gnucifer’s picture

StatusFileSize
new844 bytes
gnucifer’s picture

StatusFileSize
new781 bytes

Accidently removed a line.

gnucifer’s picture

Title: not possible to use field_language for new entities » not possible to use field_language for new (unsaved) entities
recrit’s picture

Status: Needs review » Closed (duplicate)