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!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hutch’s picture

Line 136 of getdirections_fields.module:

if ($location = $entity->{$locative_field_name}[$lang][$delta]) {

The culprit is almost certainly $lang, this is set from $entity->language but $entity->{$locative_field_name}[$lang] is not "de", probably "und" or undefined

So 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.

4kant’s picture

hutch - 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!

hutch’s picture

Can you try something?
Edit getdirections_fields.module lines 136, 139, 140
replace
$lang
with
$langcode
see if that works

4kant’s picture

Perfect - that´s it.
Thanks hutch!!

hutch’s picture

Fix commited to dev, thanks for your help.

hutch’s picture

Category: support » bug
Status: Active » Needs review
SocialNicheGuru’s picture

Issue summary: View changes
FileSize
840 bytes

I am uploading a patch based on #3 based on the dev version of 7.x.3.
There was only one occurrence of $lang

SocialNicheGuru’s picture

FileSize
3.95 KB

This is the correct patch