When I tried setting the language_default variable in a domain realm variable form the site was broken afterwards since the language code ("en") got stored in variable_store table instead of the language object. The attached patch fixes this issue for me.

CommentFileSizeAuthor
locale.variable.inc.patch597 bytespatrick r.

Comments

spike22’s picture

We (my company) also ran into this problem, by installing the latest stable Domain Access, Variable, Domain Variable modules.
We got a lot of error/notice messages, so we digged in a bit with my collegue, and this is how we solved that:

in the locale_variable_language_default_element function of inc/locale.variable.inc at line $element['#default_value'] = $element['#default_value']->language; we added an if() statement like if (!empty($element['#default_value']->language)) { $element['#default_value'] = $element['#default_value']->language; }

this is against the default value.
And in locale_variable_language_element_validate function we just replaced the line of $form_state['values'][$element['#name']] = $languages[$form_state['values'][$element['#name']]]; to $form_state['values']['variables']['regional_settings']['language_default'] = $languages[$element['#value']];

this will place the object to the right place...

I haven't tried Patrick's patch, but smtg really has to be changed in locale.variable.inc to avoid these errors.

bforchhammer’s picture

Status: Needs review » Fixed

Thanks. Commited & pushed the patch #0.

@spike22: I did not see the mentioned notice anywhere, please let us know if it still needs to be fixed as well.

Status: Fixed » Closed (fixed)

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