Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I get
Undefined index: de in getdirections_fields_field_formatter_view() (line 136 in ...sites/all/modules/getdirections/modules/getdirections_fields/getdirections_fields.module)
after I save a node with a getdirections_field in it.
Values should be read from a geocoded geofield.
Is that kind of combination impossible or what am I doing wrong?
I am using
- addressfield (tried every possible input and display)
- geocoder
- geofield (gets it´s values from the geocoded addressfield, tried every possible display)
Every module is in the most recent version.
Thanks!
Comment | File | Size | Author |
---|---|---|---|
#8 | 1982706-undefined-index-langcode-1.patch | 3.95 KB | SocialNicheGuru |
Comments
Comment #1
hutch CreditAttribution: hutch commentedLine 136 of getdirections_fields.module:
The culprit is almost certainly
$lang
, this is set from$entity->language
but$entity->{$locative_field_name}[$lang]
is not "de", probably "und" or undefinedSo the problem is that the overall entity language is set to "de" but the field language is not, why or how they are out of sync I do not know. If you can have a look at your db with phpmyadmin or similar, if you called the geofield field "field_location" then the table will be called "field_data_field_location" and it will have a language column. If the entity is a node the node table will also have a language column. Compare the two.
Not sure what the solution is but this suggests that the language setup is incomplete or that the overall language was not set at the time that the geofield field was created.
Comment #2
4kant CreditAttribution: 4kant commentedhutch - thanks for your quick answer.
You´re right - the entity is a node with language "de" and ALL fields (even others in every content type) are "und".
I did not know that this had to be equal or to be set in any way - right now I even don´t believe that this had been a request, at least as long as translation modules come into play ;-)
And this lack of knowledge leads to a question concerning your last section above: What do you mean with ..."that the language setup is incomplete"? Am I missing something? (The overall language WAS set at the time that the geofield field was created.)
Again thanks!
Comment #3
hutch CreditAttribution: hutch commentedCan you try something?
Edit getdirections_fields.module lines 136, 139, 140
replace
$lang
with
$langcode
see if that works
Comment #4
4kant CreditAttribution: 4kant commentedPerfect - that´s it.
Thanks hutch!!
Comment #5
hutch CreditAttribution: hutch commentedFix commited to dev, thanks for your help.
Comment #6
hutch CreditAttribution: hutch commentedComment #7
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedI am uploading a patch based on #3 based on the dev version of 7.x.3.
There was only one occurrence of $lang
Comment #8
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedThis is the correct patch