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().

<?php
 
if (module_exists('openlayers')) {
   
openlayers_include();
  }
?>

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?

Comments

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
+1

Any solution to this?

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. :-)

<?php
function MYMODULE_inti() {
  if (
module_exists('openlayers')) {
   
openlayers_include();
  }
}
function
MYMODULE_map() {
 
$map = openlayers_map_load('MAPNAME');
 
$output = openlayers_render_map($map->data, $map->name);
  print
$output;
}
?>

Status:Active» Fixed

Status:Fixed» Closed (fixed)

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

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.

<?php
   
...
    function
ajax_link_response($type = 'ajax') {
      ...
     
$view = views_get_view('view-name');
     
$view->set_display('display-name');
     
$view->exposed_input['myfilter'] = 'filter-value';
     
$view->pre_execute();
     
// $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

Status:Active» Closed (duplicate)

Hello,

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.

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.

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 .