Hi!

I need to change the default "Location markers #X" layer title for "ip_geoloc_marker_layerX" layers.

So I go to /admin/structure/openlayers/layers (see picture one in attachment) and click EDIT on my first marker.

I arrive to picture two: I can change the title, but now I have to mandatory choose the layer type that was RAW originally. RAW is not present in the option list, so: what type is right to choose?

Thank you very much!

Comments

rdeboer’s picture

Hi MXT,
To be honest... no idea! I haven't gone there myself.
OSM and XYZ seem the most likely candidates to me....
Strange that RAW doesn't come up...
Let us know how you go.
Rik

rdeboer’s picture

HI MXT,
Did you find out more on this issue?
I haven't had time to look into it yet.
Rik

mxt’s picture

StatusFileSize
new40.91 KB

I've tried to choose XYZ but I've not reached the result I want.

What I want is to change the marker labels that appears on the map (see screenshot).

Changing the default "Location markers #X" layer title for "ip_geoloc_marker_layerX" layers in /admin/structure/openlayers/layers has the result only to create another "layer label" (see the label "MARKER MAX" that's appear under "base layer group", always in the same screenshot).

How I can reach my purpose?

Thank you very much

rdeboer’s picture

Yes how to change these labels, indeed...
I'll have to research how OpenLayers works.... not my favourite topic... haha...
Rik

leveller’s picture

StatusFileSize
new23.78 KB

I implemented the following hook to add the Raw type to the layer type dropdown when editing the layer. This allows you to change the title and successfully save the layer; I don't know if this is the best solution though!

/**
 * Implements openlayers_layer_types().
 */
function MY_MODULE_openlayers_layer_types() {
  return array(
    'openlayers_layer_type_MY_MODULE' => array(
      'title' => t('Raw'),
      'description' => t('Layer type for raw data input - 
        not meant to be added with the UI.'),
      'type' => 'layer',
      'path' => drupal_get_path('module', 'openlayers') . '/plugins/layer_types',
      'file' => 'openlayers_layer_type_raw.inc',
      'layer_type' => array(
        'class' => 'openlayers_layer_type_raw',
        'parent' => 'openlayers_layer_type',
      ),
    ),
  );
}
rdeboer’s picture

That's great Vin!
Thanks for sharing.
Rik

mxt’s picture

Thank you very much leveller, I've implemented your suggestion and finally I was able to change the label.

But I receive the following notice on save:

Notice: Undefined index: openlayers_layer_type_helper in openlayers_layers_ui->edit_form_submit() (line 12 of /var/www/mysite/sites/all/modules/contrib/openlayers/modules/openlayers_ui/plugins/export_ui/openlayers_layers_ui.class.php).

the code I wrote is:

/**
* Implements openlayers_layer_types().
*/
function helper_openlayers_layer_types() {
  return array(
    'openlayers_layer_type_helper' => array(
      'title' => t('Raw'),
      'description' => t('Layer type for raw data input - not meant to be added with the UI.'),
      'type' => 'layer',
      'path' => drupal_get_path('module', 'openlayers') . '/plugins/layer_types',
      'file' => 'openlayers_layer_type_raw.inc',
      'layer_type' => array(
        'class' => 'openlayers_layer_type_raw',
        'parent' => 'openlayers_layer_type',
      ),
    ),
  );
}

I'm missing something?

rdeboer’s picture

Thanks again to both of you, leveller and MXT...

I haven't put this through its paces, but if I take the code from #5, replace MY_MODULE by 'ip_geoloc' and wack it into ip_geoloc.module would that solve everyone's issue?
Bar that Notice discovered by MXT in #7, of course...

Rik

leveller’s picture

Sounds good to me.

Vin.

rdeboer’s picture

Assigned: Unassigned » rdeboer
Status: Active » Fixed

Committed #5 to 7.x-1.x with attribution. Not properly tested yet.
Thanks Vin.
Rik

Status: Fixed » Closed (fixed)

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

IKE0088’s picture

Possibly related: http://drupal.org/node/1920586
I tried the fix for #5 and tried both MY_MODULE and change to ip_geoloc. Neither worked.

rdeboer’s picture

@IKE0088, #12

The fix w.r.t to #5 refers to you writing a small module, code-named MY_MODULE and putting that function in, with the 2 replacements of MY_MODULE.

The good news is that with the latest IP Geolocation Views & Maps check-in (corresponding to a development snapshot dated 20 Feb 2013 or later) that function is included.

See if that works for you.

Rik