After having upgraded to 7.x-2.x-dev I get the following error on a page that displays a map.

Notice: Undefined index: map_name in theme_openlayers_map() (line 15 of /sites/all/modules/openlayers/includes/openlayers.theme.inc).

The map does display.

Thanks.

CommentFileSizeAuthor
#3 map_name-1144542-3.patch518 bytespontus_nilsson

Comments

Jerome F’s picture

So do I

yli_ektor’s picture

Me to

pontus_nilsson’s picture

Status: Active » Needs review
StatusFileSize
new518 bytes

The array $args looks like this
map->map_name
map->other stuff
presetname

but right now map_name is adressed as if it was directly under $args.

  $map = $args['map'];
  $map_name =  $args['map_name'];

This patch adresses map_name under $map in the array.

manu manu’s picture

Thanks pontus_nilsson,

patch in #3 solved my issue, and I'm able to see map points now.

Edit: Finaly it seems to move the problem elsewhere: I had a undefined index error on admin/build/openlayers/maps/my_map/edit until I reverted the patch...

pontus_nilsson’s picture

Manu manu, I noticed the same. Anyone knows what the correct structure is, from what I understand there is some restructure work going on with openlayers that this module needs to implement.

zzolo’s picture

Category: bug » support

There is some restructure work going on. It should be correct the current way it is in the 7.x-dev version. You can look at the openlayers_render_map_data() function.

Are you upgrading from 6.x or starting new?

bjalford’s picture

I get this message using latest 7 dev version on clean install using a geofield field.

seanberto’s picture

I'm getting this error with GeoField and OLs too (running latest dev releases of each).

Looks like the $map_name variable isn't being set @ line 211 in openlayers.module:

function openlayers_render_map($map = '') {
  
  // If it's an array, then we have been passed the map data array
  if (is_array($map)) {
    return openlayers_render_map_data($map);
  }
  
  // If it's a string, then we are passing a map name instead of the whole map object
  // so we need to load the object
  if (!$map || is_string($map)) {
    $map_name = $map;
    if (!$map_name) {
      $map_name = variable_get('openlayers_default_map', 'default');
    }
    $map = openlayers_map_load($map_name);
  }
  
  if (!isset($map_name)) {
    $map_name = $map->name;
  }
  
  return openlayers_render_map_data($map->data, $map_name);
}

If $map is an array, no value for $map_name is passed to openlayers_render_map_data().

muschpusch’s picture

Status: Needs review » Reviewed & tested by the community

#3 fixes the notice!

avr’s picture

This is actually an issue wit Geofield. I've created a patch here: http://drupal.org/node/1171000#comment-4525924

Jerome F’s picture

patch pointed in #10 works

zzolo’s picture

Status: Reviewed & tested by the community » Fixed

Thank you for the patch. This should be all fixed in current dev.

Status: Fixed » Closed (fixed)

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