Hello.
After some time I've downloaded the latest dev versions of the updated sdk and of the drupal module of drupalgap too. My website provides i18 support.
In my website I can see the list of different nodes with their own language (eng or it)
When I try to edit the body of a node (with some other fields too, like addressfield etc) in the webapp, I get an empty field in the body.
In the console I get:
drupalgap_field_info_instances_add_to_form - TypeError: entity[name][language] is undefined
in drupalgap.js
In the sdk I've configured the use of locale by setting a default language (it) and enabled some of the json translations from the "locale" folder
Probably the issue has something to do with other similar, but I'm not able to fix it. I've red some other posts about similar errors but I don't know where to put the hands...
Comments
Comment #1
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedWill you please share the links to the other issues/mentions of this issue?
If I recall correctly (again I'm not a multi lingual Drupal master, I've really only ever used 'und' out of the box Drupal, and have minimal experience with multi lingual sites), I think the problem is let's say for example we had this node:
As we can see the language code is
it
, but I think Drupal returnsund
for each field language code. Will you please confirm or deny this with a few sample nodes on your site?Either way, I think I programmed the SDK to always fallback to und on fields, if there is no matching language code. But after further review, I don't think I did implement that fallback, so it is probably trying to access a language code on a field, and that doesn't exist. The problem is probably very close to here:
https://github.com/signalpoint/DrupalGap/blob/7.x-1.x/src/modules/field/...
Comment #2
kinmen CreditAttribution: kinmen as a volunteer commentedThank you for the answer.
I've thought it could be something similar to:
https://www.drupal.org/node/2441981 or
https://www.drupal.org/node/2470475
I didn't mention it before, but the localization of the webapp isn't working either, but I don't know if it has something to to with the issue above...
btw, the json of a test node shows und for field body, as well as for the other fields in the sam node:
...
I've omitted the last rows cause are just data. I Hope now it's readable
tnx again
Comment #3
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedPlease edit your comment to wrap the JSON in code brackets, or else it is un-readable.
Next, do a
console.log(name);
during the loop linked in the source code above. What field(s) are crashing out?Comment #4
kinmen CreditAttribution: kinmen as a volunteer commentedIn field.js? Which row exactly? Sorry but I'm not able to program neither js nor other languages... :-/
Comment #5
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedDownload the latest bin/drupalgap.js file, I just added an extra null checker that should fix your problem.
Comment #6
kinmen CreditAttribution: kinmen as a volunteer commentedI've downloaded it, cleared browser's cache, and now the console of FF shows:
I've just noted that not just the body field is empty in the Edit window, but also the other fields, excluded the title are empty: taxonomy term, lat/long...
Thank you for the help
Comment #7
kinmen CreditAttribution: kinmen as a volunteer commentedYesterday I've updated the SDK, and now I'm getting something more:
drupalgap 7.x-1.13+ sdk 7.x-1.x, also entity reference module for both...
At the moment I can't either save a new article, I'm getting the following error when I click on SAVE:
Comment #8
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedI've noticed on multilingual sites that an entity will have a certain language code, but then that language code doesn't exist on the entity's fields from time to time. I thought we programmed a handler to catch that and fall back to 'und'.
There is no support (AFAIK) yet for geocoder in DrupalGap. Any geocoder events server side should be fine though. Adding support for geocoder in DG shouldn't be too bad, hook_field_formatter_view() and hook_field_widget_form() in an app/modules/geocoder/geocoder.js file would get started.
Have you tried the non minified drupalgap.js file? Also try the non minified jdrupal.js file.
Comment #9
kinmen CreditAttribution: kinmen as a volunteer commentedThank you for the answer.
Switched to drupalgap.js + jdrupal.js, and now when I click on SAVE I get:
Comment #10
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedI'd recommend walking through the
drupalgap_entity_build_from_form_state()
function, and doing dpm/console prints to see what is going on.https://github.com/signalpoint/DrupalGap/blob/7.x-1.x/src/modules/entity...
Comment #11
jomarocas CreditAttribution: jomarocas as a volunteer commentedyou solution this, because im getting same errors, i cannot edit nodes correctly and edit user
Comment #12
jomarocas CreditAttribution: jomarocas as a volunteer commentedWhen i put the language in "und", i create a node and i can see the node with the content, but when i go to edit content, i cannot see the fields with the content that i make, but when i push other language in "und" i create node, and only see the title, but i dont see the content, and i cannot see the fields that i write in edit content, this is the same when i edit user i cannot see nothing field that i use when register. thanks
logs
when i create content
when i edit content
when i get the value in poster all is right, have the values, but dont show
i want help to make something to correct this, but i dont know where to start or how as do to correct these in my language
Comment #13
jomarocas CreditAttribution: jomarocas as a volunteer commented