Skip to content
Kevin Hoffman edited this page Oct 4, 2018 · 3 revisions

Shared scripts exist in the core repo. Loading scripts is handled using the Google_Maps_Builder_Scripts class, which extends the Google_Maps_Builder_Core_Scripts_Init class.

Note that Google_Maps_Builder_Core_Scripts_Init hooks into wp_enqueue_scripts and admin_enqueue_scripts twice, providing an early and late option to enqueue scripts/styles. The reason for this is that the core JavaScript declares several functions as empty, and the pro version runs after it, using the "late" hook and overrides those methods with the real versions. The result is that if the core lib is running in the free version, if those "pro only" function are called, nothing happens, which is better than an error. In the pro version, the "pro only" function is executed.

This works because the scripts all add functions to the MapsBuilderAdmin and MapsBuilder objects.

JS Hooks

gmb.initialize_map
Availability: Free/Pro
Description: Adds custom event so map can be manipulated after it is initialized.

gmb.set_mashup_marker
Availability: Pro
Description: Adds custom event so marker can be manipulated before it is set.

Google Maps Builder

Local Development

Developer Notes

Clone this wiki locally