Tribe_Events::filter_default_url( string $view_class )
Filters the default view in the views manager for shortcodes navigation.
Contents
Parameters
- $view_class
-
(string) (Required) Fully qualified class name for default view.
Return
(string) Fully qualified class name for default view of the shortcode in question.
Source
File: src/Tribe/Views/V2/Shortcodes/Tribe_Events.php
public function filter_default_url( $view_class ) {
/**
* @todo Very wrong to query directly the URL, but needed for the time being. Use the Context here! (source: Matt and Gustavo)
*/
$url_query = wp_parse_url( tribe_get_request_var( 'url', false ), PHP_URL_QUERY );
$arguments = wp_parse_args( $url_query );
if ( empty( $arguments['shortcode'] ) ) {
return $view_class;
}
$shortcode_id = $arguments['shortcode'];
if ( false === $shortcode_id ) {
return $view_class;
}
$shortcode_args = $this->get_database_arguments( $shortcode_id );
return tribe( Views_Manager::class )->get_view_class_by_slug( $shortcode_args['view'] );
}
Changelog
| Version | Description |
|---|---|
| 4.7.9 | Introduced. |