function gmw_results_map($gmw) { //temporary. needs to be removed. if ($gmw['search_results']['display_map'] != 'results' && empty($gmw['map_shortcode'])) { return; } do_action("gmw_before_map", $gmw); do_action("gmw_before_map_{$gmw['ID']}", $gmw); do_action("gmw_{$gmw['prefix']}_before_map", $gmw); echo gmw_get_results_map($gmw); do_action("gmw_after_map", $gmw); do_action("gmw_after_map_{$gmw['ID']}", $gmw); do_action("gmw_{$gmw['prefix']}_after_map", $gmw); }
/** * Map element * @since 2.6.1 * @access public */ public function map() { //if item has no location, abort! if (empty($this->item_info)) { return !empty($this->args['no_location_message']) ? $this->no_location_message() : false; } //map arguments $gmw = array('ID' => $this->args['element_id'], 'prefix' => 'sl', 'addon' => 'single_location', 'results_map' => array('map_width' => $this->args['map_width'], 'map_height' => $this->args['map_height']), 'args' => $this->args, 'user_position' => $this->user_position, 'item_info' => $this->item_info, 'expand_map_on_load' => $this->args['expand_map_on_load']); //get the map element $output = gmw_get_results_map($gmw); $post_map_icon = !empty($this->args['item_map_icon']) ? $this->args['item_map_icon'] : false; $mapArgs = array('mapId' => $this->args['element_id'], 'mapType' => 'single_location', 'prefix' => 'sl', 'mapElement' => 'gmw-map-' . $this->args['element_id'], 'locations' => array(0 => array('lat' => $this->item_info->lat, 'long' => $this->item_info->long, 'info_window_content' => $this->info_window_content(), 'mapIcon' => apply_filters('gmw_sl_post_map_icon', $post_map_icon, $this->args, $this->item_info, $this->user_position))), 'zoomLevel' => !empty($this->user_position['exists']) ? 'auto' : $this->args['zoom_level'], 'mapOptions' => array('mapTypeId' => $this->args['map_type'], 'mapTypeControl' => false, 'streetViewControl' => false, 'scrollwheel' => !empty($this->args['scrollwheel_map_zoom']) ? true : false, 'panControl' => false), 'userPosition' => array('lat' => $this->user_position['lat'], 'lng' => $this->user_position['lng'], 'address' => $this->user_position['address'], 'mapIcon' => $this->args['user_map_icon'], 'iwContent' => $this->args['user_info_window'])); gmw_new_map_element($mapArgs); return $output; }
/** * @since 2.6.1 * @access public * * Create map element */ public function map() { if (!$this->user_position['exists']) { return; } //map arguments $gmw = array('ID' => $this->args['element_id'], 'prefix' => 'cl', 'addon' => 'current_location', 'results_map' => array('map_width' => $this->args['map_width'], 'map_height' => $this->args['map_height']), 'args' => $this->args, 'user_position' => $this->user_position); //get the map element $output = gmw_get_results_map($gmw); //map options - pass to via global map object to JavaScript which will display the map $mapArgs = array('mapId' => $this->args['element_id'], 'mapType' => 'current_location', 'prefix' => 'cl', 'zoomLevel' => $this->args['zoom_level'], 'mapOptions' => array('mapTypeId' => $this->args['map_type'], 'scrollwheel' => !empty($this->args['scrollwheel_map_zoom']) ? true : false, 'mapTypeControl' => false, 'streetViewControl' => false, 'panControl' => false), 'userPosition' => array('lat' => $this->user_position['lat'], 'lng' => $this->user_position['lng'], 'address' => $this->user_position['address'], 'mapIcon' => $this->args['map_marker'])); gmw_new_map_element($mapArgs); return $output; }
/** * Create the map element */ public function map_element() { //map arguments $gmw = array('ID' => 'sd', 'prefix' => 'sd', 'addon' => 'sweetdate_geolocation', 'results_map' => array('map_width' => $this->settings['map_width'], 'map_height' => $this->settings['map_height']), 'formData' => $this->formData); //get the map element $output = gmw_get_results_map($gmw); echo $output; }