I'm trying to dynamically pass in arguments to an OpenLayers view to create some maps on the fly. For example:

print views_embed_view('listing_node_map', 'block', views_embed_view('listing_node_map_source', 'openlayers_1', 3486));

In this snippet, 'listing_node_map' is my OpenLayers Map view and 'listing_node_map_source' is my OpenLayers Data Source view, which has a node ID argument (3486 in this case). The above will actually render the map fine, albeit without data. If I just print the latter views_embed_view call it's not returning any data. Is there any way to achieve this behaviour?

Comments

zzolo’s picture

Component: OpenLayers Views » OL API
Status: Active » Closed (works as designed)

Hey @ivashrestha. Sorry for the delay. Were you ever able to figure this out? Lots of changes have happened since your original message. Anything you can report back is helpful.

Closing for now; please feel free to re-open if needed.

zzolo’s picture

Hey @evan23, sorry for the name mix up (apparently command-C missed).

kevinquillen’s picture

I cannot get this to work either, have tried lots of views_embed_view statements, including one like the OP.

An empty map just shows without data and without extra settings (fullscreen button, etc). No idea why it won't show, and I have to embed this programatically in the middle of a TPL.

musa.thomas’s picture

I can't do any views_embed_view. I try first to do just one views_embed_view=> the map print only if their are no result if you have arg on your view, if their are result their are no result. If you have not an arg the view is empty.
Same result with double views_embed_views, if you have no args there are no maps, if you have an argument and their are result you have no maps, but map is here for no results. I try module invoke but less results than views_embed

chrsnlsn’s picture

I have been creating my maps on the fly using the GeoJSON format for the layers and using an internal link to which I have written a callback function for where I either call a GeoJSON formatted view or hit an external API after appending some custom variables onto the calls. Maybe that could work for you as well?

pol’s picture

Status: Closed (works as designed) » Fixed

Status: Fixed » Closed (fixed)

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