On various places is a text displayed that some users don't want. Specialy for productivity sites.

The module prints a "Test" out. Please remove this on releases.

Comments

tecjam’s picture

This is found on line 93 of the geofield_map.module file.

$element[0]['#markup'] = '<div style="width: ' . $width . '; height: ' . $height . '" id="geofield_map_entity_' . $entity_id . '" class="geofieldMap">Test</div>';

Line 147 of includes/geofield_map_plugin_style_map.inc

return '<div style="width: ' . $width . '; height: ' . $height . '" id="geofield_map_' . $this->view->name . '_' . $this->view->current_display . '" class="geofieldMap">Test</div>';

and last but not least, in the javascript file:

Line 79 of js/geofield_maps.js

                var marker = new google.maps.Marker({
                  position: point,
                  map: map,
                  title: "test"
                });

I would much prefer the node title to display there on hover. And also be able to use google.maps.InfoWindow class to open a window on click with maybe node title, image address and any other field you wish to show in it.

Now .. how to do it?

Ok, so after some taking apart we first need to define the node title, so we need to edit the geofield_map_field_formatter_view () function in geofield_map.module

so I added the following after line 51 - which reads:

$element = array();

  // grab node title
  if($entity->title) {
    $entity_title = $entity->title;
  }

Then we need to define it in js, so in line 77 i modified this:

  $js_settings = array(
    $entity_id => array(
      'map_id' => 'geofield_map_entity_' . $entity_id,
      'map_settings' => $map_settings,
      'data' => geofield_map_process_points($raw_data),
    ),
  );

and added the node title:

$js_settings = array(
$entity_id => array(
'map_id' => 'geofield_map_entity_' . $entity_id,
'map_settings' => $map_settings,
'data' => geofield_map_process_points($raw_data),
// add node title
'entity_title' => $entity_title,
),
);

now I presume we need to grab the stuff in the .js file:

around line 13

            map_settings = settings[i].map_settings;
            entity_title = settings[i].entity_title;

now replace the "test" text with entity_title i think, but I can't get the last thing to work .. I'll try a little later.

Brandonian’s picture

@tecjam, thanks for hunting down my dummy text. I had forgotten how many places I had left.

I've just commited a change on 7.x-1.x-dev for #1359606: Geofield Map - multiple minor issues that should take care of the alt text in Views. If you grab the latest dev, you now have the ability to define what is displayed there in the style options of the view.

We still need to address the standalone element and marker alt texts. Because this submodule of geofield is meant to be used only for very basic mapping cases, I'd like to keep things simple. I propose we provide a similar alt text option on the standalone entity map display options, and drop the title altogether for the markers.

RuiMendes’s picture

Hi,

I'm using views display a geofield with the formatter "Geofield Map" but what I get as output is:
<div id="geofield_map_entity_field_event_geofield_3" class="geofieldMap" style="width: 100%; height: 300px">Test</div>

instead of the actual map.

Could someone please help. One other problem that I've found is that if the formatter "Geofield Map" when I try to edit the field on the view the edition popup doesn't show.

Thanks.

Btw the others formatters works, the problem apparently is only with the "Geofield Map" formatter.

phayes’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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