If the form controllers sets the language to the default language and the language module is not enabled, $entity->language() won't work as the default language cannot be loaded via language_load() then. Everything is fine if the language module is enabled, however we do not want the entity system to depend on that. Right now - in order to work properly - it does. :/

To fix, we need to make sure that $entity->language() is set to a valid value and works. Presuming that language_default() should be valid, I think it should be loadable via language_load() as well then.

Comments

plach’s picture

Issue tags: +language-content

Presuming that language_default() should be valid, I think it should be loadable via language_load() as well then.

What's wrong with calling language_default()?

fago’s picture

The code there just has langcode and needs to get the language, so it uses language_load(). But that doesn't work for teh default language. Of course, we could special case that and check for the langcode being default language, but I do think this is something we probably want to fix in language_load() instead.

plach’s picture

Status: Active » Closed (duplicate)
plach’s picture

Title: $entity->language() depends on language module » Implement hook_entity_create() to setup the default entity language
Component: entity system » language.module
Category: bug » task
Status: Closed (duplicate) » Postponed

Repurposing. Postponed on the issue above.

plach’s picture

Status: Postponed » Active
plach’s picture

Status: Active » Closed (duplicate)