I am the maintainer of the colorbox_node module. I had a request come in trying to get a map to display in a colorbox modal. I am using Drupal's built in AJAX Framework to load the data into the modal window. When rendering the map, it throws errors. I have tried to add this in the init().

  if (module_exists('openlayers')) {

It got me a little further but it still fails out. I am just curious if these maps will load through Drupal's Built-in AJAX or not?


treckstar’s picture

Would love to know if anyone has a solution to opening a geofield map or openlayers map in a colorbox through drupal's built in ajax

poeticdevel’s picture

Any solution to this?

paulhudson’s picture

I'm using this to render a map form a D7 link ajax request. Seems to work fine, but I'm not passing arguments to it at the moment. Should get you setup for some more advance tweaking. :-)

function MYMODULE_inti() {

  if (module_exists('openlayers')) {

function MYMODULE_map() {

  $map = openlayers_map_load('MAPNAME');
  $output = openlayers_render_map($map->data, $map->name);

  print $output;
Pol’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

FranciscoLuz’s picture

Title: Loading a map through Drupal's AJAX Framework. » How to load an OpenLayers view into the content area with an AJAX link?
Status: Closed (fixed) » Active

I have a link in the side bar that links to a map page view.

I would like to Ajaxify it so the view is loaded into the content area without a page re-load.

I am using the Ajax link example in the Example module and saving the $output at ajax_link_response() with this code:

PS: The snapshot code below works just fine with non OpenLayers views.

    function ajax_link_response($type = 'ajax') {
      $view = views_get_view('view-name');
      $view->exposed_input['myfilter'] = 'filter-value';

      // $output = t("This is some content delivered via AJAX");

      $output = $view->render();

The map view does not load into the wrapper div. What am I missing?

PS: The solution on #3 did not work either.

Gist files:

- ajax_example.module
- ajax_example.misc.inc

Pol’s picture

Status: Active » Closed (duplicate)


I'm working on it, we need to implement a new element 'openlayers' to succeed to do this.

I have something working at 75% right now.

Any help is greatly appreciated.

See #1895530: Use the new 'openlayers' element..

I'm marking this as duplicated.

pradeep_4171’s picture

Priority: Normal » Major
Status: Closed (duplicate) » Active

Hi am facing the same issue..
Could you please explain how we can load open layers map through ajax call.
Please tell me what is map name here.whether it is machine_name or title.

pradeep_4171’s picture

Hi i tried as you said.Its not working.Is their any other way to render map.I even searched their docs.nothing they provided except these two functions.
Is it possible to render map in this way?
Any help would be appreciated .

ErebusDG’s picture

Issue summary: View changes

I hate to bring this back from the dead, but I too am facing issues with displaying a node in a modal window using Colorbox Node. If the node has an OpenLayers map, the modal simply never loads the content. What's the progress on fixing this? Not sure if this belongs here or over at the ColorBox Node module issues, so I'm posting in both...

Pol’s picture

Status: Active » Closed (won't fix)

AJAX with 7.x-2.x is not possible.

For AJAX based maps, the upcoming 7.x-3.x.x version will be able to handle it, have a look at this: https://groups.drupal.org/node/440733 and the demo site: http://dev.through-my-eyes.be/