My node configurated to be terms of use is in zh-hans language (Chineese). In user_registration_form_alter, we try to get the body with $node->body[$node->language]. But in the table field_data_body, language related to the body of my node is declared as undefined. I try several possibilities with translation module. Even if I have a translated node for my terms_of_use, the body is always saved as undefined language in database. I can't find an example where the body is saved as $node->language in the database (unless my node is in undefined language).
Notice: Undefined index: zh-hans in terms_of_use_form_user_register_form_alter() (line 88 of /var/www/deployments/instance_s3/sites/all/modules/contrib/terms_of_use/terms_of_use.module)
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 1378600-7.patch | 807 bytes | dsdeiz |
| #1 | terms_of_use-undefined_index_language-1378600.patch | 626 bytes | vbouchet |
Comments
Comment #1
vbouchetComment #2
guillaumev commentedExact same problem here. I can confirm the patch is working. Would love to see this committed :-)
Comment #3
Québec commentedHi,
patch is working (my first patch ever!). Would love to see this committed églament! :-)
R.
Comment #4
semiaddict commentedWorks for me as well, and would indeed love to see it committed.
Comment #5
dsdeiz commentedWorks here as well.
Comment #6
kars-t commentedHi
I fear we need some other solution for this. The node always has somekind of language. In this case it is "und" = "undefined". But this isn't always the case. And you probably use field translation or at least the i18n module?
Always using LANGUAGE_NONE which actually is "und" can give us problems again. There should be a more robust API call to get the data from $node->body. I don't thing it is field_get_items but maybe it works. Please check this and if possible reroll the patch.
Comment #7
dsdeiz commentedHi, patch attached.
Comment #8
dsdeiz commentedComment #9
kars-t commentedHi
Thanks for the patch!
I did change this a bit further so we get the value with field_view_value().