Problem/Motivation
The core function entity_language returns NULL
for field collection items. This is due to the fact that fc entities neither provide a language callback
nor define a language
entity key.
As a result if third-party code attempts to use entity_language()
to determine a field language such as for example entity_metadata_field_get_language() it might end up returning NULL
as well. In this example the calling entity_metadata_field_verbatim_get() assumes that the returned $langcode
is never NULL
and as a consequence fails to retrieve values from fields with LANGUAGE_NONE
.
It is debatable if this is an issue with field collection or the entity module. In my opinion it wouldn't hurt to fix both, i.e. make field collection play well with entity_language()
as well as fix entity_metadata_field_get_language()
such that it can handle NULL
returned from entity_language()
.
Proposed resolution
(Description of the proposed solution, the rationale behind it, and workarounds for people who cannot use the patch.)
Remaining tasks
?
User interface changes
?
API changes
?
Data model changes
None.
Comments
Comment #2
znerol CreditAttribution: znerol commentedRelated issue #2907128: entity_metadata_field_get_language() does not check for NULL returned by entity_language() over at Entity API.