View::url_for_query_args( $date = null, $query_args = array() )
{@inheritDoc}
Source
File: src/Tribe/Views/V2/View.php
public function url_for_query_args( $date = null, $query_args = [] ) {
$event_date = Dates::build_date_object( $date )->format( $this->get_url_date_format() );
if ( ! empty( $query_args ) && is_string( $query_args ) ) {
$str_args = $query_args;
$query_args = [];
wp_parse_str( $str_args, $query_args );
}
$url_query_args = array_filter( array_merge( $query_args, [
'eventDisplay' => $this->get_slug(),
'eventDate' => $event_date,
] ) );
if ( static::$date_in_url ) {
unset( $url_query_args['tribe-bar-date'] );
// This is the case for Views that include the date in the "pretty" URL, e.g. Month, Day or Week.
return tribe_events_get_url( $url_query_args );
}
// This is the case for Views that don't include the date in the "pretty" URL, e.g. List.
unset( $url_query_args['eventDate'] );
return add_query_arg(
[ 'tribe-bar-date' => $event_date ],
tribe_events_get_url( $url_query_args )
);
}