/** * live directions function * @since 2.6.1 * @access public */ public function live_directions() { //if item has no location, abort! if (empty($this->item_info)) { return !empty($this->args['no_location_message']) ? $this->no_location_message() : false; } $info = new stdClass(); $info->ID = $this->args['element_id']; $info->address = $this->item_info->address; $info->lat = $this->item_info->lat; $info->long = $this->item_info->long; $gmw['org_address'] = $this->user_position['address']; $gmw['labels'] = $this->labels; $gmw['ID'] = $this->args['element_id']; $element_id = esc_attr($this->args['element_id']); $i_type = esc_attr($this->args['item_type']); $output = "<div class=\"gmw-sl-live-directions-trigger-wrapper\">"; $output .= "<i class=\"gmw-live-directions-icon fa fa-arrow-circle-right\"></i>"; $output .= "<a href=\"#\" id=\"gmw-sl-live-directions-trigger-{$element_id}\" class=\"gmw-sl-live-directions-trigger gmw-sl-{$i_type}-live-directions-trigger\" onclick=\"event.preventDefault();jQuery('#gmw-sl-live-directions-wrapper-{$element_id}, #gmw-sl-live-directions-panel-wrapper-{$element_id}').slideToggle();\">" . esc_attr($this->labels['live_directions']['trigger_label']) . "</a>"; $output .= "</div>"; $output .= "<div id=\"gmw-sl-live-directions-wrapper-{$element_id}\" class=\"gmw-sl-live-directions-wrapper gmw-sl-element gmw-sl-{$i_type}-live-direction-wrapper live-directions-wrapper\">"; $output .= "<input type=\"hidden\" class=\"gmw-sl-directions-element-id\" value=\"{$element_id}\" />"; $output .= gmw_get_live_directions($info, $gmw); $output .= "</div>"; wp_enqueue_script('gmw-sl-live-directions'); return apply_filters('gmw_sl_live_directions', $output, $this->args, $this->item_info, $this->user_position); }
function gmw_live_directions($info, $gmw) { echo gmw_get_live_directions($info, $gmw); }