Support » Plugin: Events Manager » [CODE FIX] Locations Map: markers array

  • Resolved raruto

    (@raruto)


    Hello, and thanks for the great plugin!
    I would like to propose a slight modification of the code in the event-manager.js file (which I think was already actually what you intended to do… modifying-event-location-google-maps).

    in the event-manager.js file (about line 875)
    maps_markers[map_id].push(marker);
    you populate the array “maps_markers[map_id]”with google maps markers of locations, but it is never used within the function!
    To be able to work on the map it is necessary to keep track of the added marker on it (as you did)

    My proposal is to edit the hook line (about line 894) in future updates:
    ORIGINAL:

    //Call a hook if exists
    jQuery(document).triggerHandler('em_maps_locations_hook', [maps[map_id], data, map_id);

    UPDATED:

    //Call a hook if exists
    jQuery(document).triggerHandler('em_maps_locations_hook', [maps[map_id], data, map_id, maps_markers[map_id]]);

    As you can see in: modifying-event-location-google-maps

    For the global maps, it’s the same principle, except the hook is called em_maps_locations_hook and one variable is supplied which is an array of markers.

    you talk about “array of markers” and NOT “array of locations”.
    it is my misunderstanding? or you have forgotten to implement it?

    NB.
    In the ’em_maps_locations_hook’ the two arrays should be kept both, because:
    – “data” is an array of locations that can NOT be used to interact with the google map (view: markers#remove), but useful to apply advanced filters (eg. EM functions…)
    – “maps_markers[map_id]” is an array of google markers that can be used to interact with the google map (eg. MarkerClustering, Show/Hide Markers, etc. etc.)

    I look forward,
    Raruto

    • This topic was modified 6 months, 4 weeks ago by  raruto.
Viewing 2 replies - 1 through 2 (of 2 total)
  • caimin_nwl

    (@caimin_nwl)

    NetWebLogic Support

    Hi Raruto,

    Glad you’re enjoying the plugin. I’ve passed on your suggestion to the Dev team for their consideration.

    Plugin Author Marcus

    (@netweblogic)

    NetWebLogic Support

    Hi Raruto,

    Sorry for the delayed reply, but yes you’re right. It is meant to be supplied there, and I’ll add it to the end of that trigger as you suggested. Thanks for pointing that out with the detailed fix!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.