protected function setup_coords($map_index) { $embedded_maps = Tribe__Events__Embedded_Maps::instance(); $venue_data = $embedded_maps->get_map_data($map_index); $venue_data['coords'] = array($this->lat, $this->lng); $embedded_maps->update_map_data($map_index, $venue_data); }
/** * @return Tribe__Events__Embedded_Maps */ public static function instance() { if (!isset(self::$instance)) { self::$instance = new self(); } return self::$instance; }
/** * Update the location information associated with the venue map to use coordinates * in place of a street address, if possible. * * @param $map_index * @param $venue_id */ public function use_coords($map_index, $venue_id) { // Sanity checks: we need a venue to work with and the correct version of TEC if (!tribe_is_venue($venue_id)) { return; } if (!class_exists('Tribe__Events__Embedded_Maps')) { return; } // Try to load the coordinates - it's possible none will be set $lat = get_post_meta($venue_id, $this->lat_key, true); $lng = get_post_meta($venue_id, $this->lng_key, true); if (!$this->valid_coords($lat, $lng)) { return; } // If we have valid coordinates let's put them to work $mapping = Tribe__Events__Embedded_Maps::instance(); $venue_data = $mapping->get_map_data($map_index); $venue_data['coords'] = array($lat, $lng); $mapping->update_map_data($map_index, $venue_data); }
/** * Google Map Embed * * Returns an embedded google maps for an event * * @category Events * * @param string $post_id * @param int $width * @param int $height * @param bool $force_load If true, then load the map even if an address is not provided. * * @return string An iframe pulling http://maps.google.com/ for this event */ function tribe_get_embedded_map($post_id = null, $width = null, $height = null, $force_load = false) { return Tribe__Events__Embedded_Maps::instance()->get_map($post_id, $width, $height, $force_load); }