Usage
placeLookup(placeID)
Parameters
placeID
(Required) (String) The place ID to look up.
Default: None
Examples
Called after a successful (and accurate) address lookup from Google Maps.
placeLookup(results[0].place_id);
Additional Notes
This function triggers placeSuccess on success when the nebula.session.geolocation.address.place object can be used.
Source File
Located in /assets/js/modules/location.js on line 353.
No Hooks
This function does not have any filters or actions available. Request one?nebula.placeLookup = function(placeID){ if ( google?.maps?.places ){ let service = new google.maps.places.PlacesService(jQuery('<div></div>').get(0)); service.getDetails({ placeId: placeID }, function(place, status){ if ( status === google.maps.places.PlacesServiceStatus.OK ){ if ( typeof place.name !== 'undefined' ){ nebula.session.geolocation.address.place = { id: placeID, name: place.name, url: place.url, website: place.website, phone: place.formatted_phone_number, ratings: { rating: place.rating, total: place.user_ratings_total, reviews: ( typeof place.reviews !== 'undefined' )? place.reviews.length : 0, }, utc_offset: place.utc_offset, }; sessionStorage['nebulaSession'] = JSON.stringify(nebula.session); nebula.dom.document.trigger('placeSuccess'); } } }); } };
Override
To override or disable this JavaScript function, simply redeclare it with the exact same function name. Remember: Some functionality is conditionally loaded via dynamic imports, so if your function is not overriding properly, try listening for a DOM event (described below).
For non-module import functions:
nebula.placeLookup = function(placeID){ //Write your own code here, leave it blank, or return false. }
For dynamically imported module function overrides:
jQuery(window).on('load', function(){ nebula.placeLookup = function(placeID){ //Write your own code here, leave it blank, or return false. } });
Custom Nebula DOM events do also exist, so you could also try the following if the Window Load listener does not work:
jQuery(document).on('nebula_module_loaded', function(module){ //Note that the module variable is also available to know which module specifically was imported if ( typeof nebula.placeLookup === 'function' ){ nebula.placeLookup = function(placeID){ //Write your own code here, leave it blank, or return false. } } });