<?php /** * Events Navigation Bar Module Template * Renders our events navigation bar used across our views * * $filters and $views variables are loaded in and coming from * the show funcion in: lib/Bar.php * * @package TribeEventsCalendar * */ ?> <?php $filters = tribe_events_get_filters(); $views = tribe_events_get_views(); $current_url = tribe_events_get_current_filter_url(); ?> <?php do_action('tribe_events_bar_before_template'); ?> <div id="tribe-events-bar"> <form id="tribe-bar-form" class="tribe-clearfix" name="tribe-bar-form" method="post" action="<?php echo esc_attr($current_url); ?> "> <!-- Mobile Filters Toggle -->
/** * Take care of common setup needs including enqueing various assets required by the default views. */ public function prepare_default() { global $wp_query; /** * We overwrite the global $wp_query object to facilitate embedding the requested view (the * original will be restored during tribe_events_pro_tribe_events_shortcode_post_render): * this isn't ideal, but further restructuring of our template classes and event views would * be needed to avoid it. * * @see $this->reset_query() * @todo revise in a future release */ $wp_query = new WP_Query($this->query_args); // Assets required by all our supported views wp_enqueue_script('jquery'); Tribe__Events__Template_Factory::asset_package('bootstrap-datepicker'); Tribe__Events__Template_Factory::asset_package('calendar-script'); Tribe__Events__Template_Factory::asset_package('jquery-resize'); Tribe__Events__Template_Factory::asset_package('events-css'); Tribe__Events__Pro__Template_Factory::asset_package('events-pro-css'); // Tribe Events Bar support if ($this->is_attribute_truthy('tribe-bar', true)) { add_filter('tribe_get_option', array($this, 'filter_tribe_disable_bar'), 10, 2); // Make sure the filters have been initialized tribe_events_get_filters(); add_filter('tribe-events-bar-should-show', array($this, 'enable_tribe_bar')); remove_action('tribe_events_bar_before_template', array(Tribe__Events__Bar::instance(), 'disabled_bar_before')); remove_action('tribe_events_bar_after_template', array(Tribe__Events__Bar::instance(), 'disabled_bar_after')); Tribe__Events__Template_Factory::asset_package('jquery-placeholder'); Tribe__Events__Pro__Template_Factory::asset_package('ajax-maps'); Tribe__Events__Template_Factory::asset_package('jquery-resize'); add_action('tribe_events_bar_before_template', array(Tribe__Events__Bar::instance(), 'disabled_bar_before')); add_action('tribe_events_bar_after_template', array(Tribe__Events__Bar::instance(), 'disabled_bar_after')); remove_filter('tribe_get_option', array($this, 'filter_tribe_disable_bar')); } // Add the method responsible for rendering each of the default supported views add_filter('tribe_events_pro_tribe_events_shortcode_output', array($this, 'render_view')); // View selector URLs will need to be adjusted (so that the user is not taken to /events/new-view/) add_filter('tribe-events-bar-views', array($this, 'modify_view_urls'), 100); }