Tribe__Events__Community__Integrations__Virtual_Events
Handle integration of Community Events and the Virtual Events add-on.
Does not run unless Virtual Events add-on is active.
See also
Source
File: src/Tribe/Integrations/Virtual_Events.php
class Tribe__Events__Community__Integrations__Virtual_Events { /** * Setup the hooks for Virtual Events integration. * * @since4.8.0 */ public function hooks() { add_filter( 'tribe_events_virtual_link_allow_generation', [ $this, 'maybe_allow_meeting_link_generation' ] ); add_action( 'tribe_community_events_enqueue_resources', [ $this, 'enqueue_assets' ] ); add_action( 'tribe_events_community_form_before_linked_posts', [ $this, 'render_meta_box' ] ); } /** * Maybe allow meeting link generation. * * @since4.8.0 * * @param boolean $allow_generation Whether to allow meeting link generation. * * @return boolean Whether to allow meeting link generation. */ public function maybe_allow_meeting_link_generation( $allow_generation ) { if ( false === $allow_generation ) { return $allow_generation; } // Don't allow meeting link generation from the frontend or if they are not a site admin. if ( ! is_admin() || ( ! is_super_admin() && ! current_user_can( 'manage_options' ) ) ) { return false; } return $allow_generation; } /** * Handle enqueuing the assets for Virtual Events. * * @since4.8.0 */ public function enqueue_assets() { if ( ! tribe_is_community_edit_event_page() ) { return; } // VE's 'admin' CSS and JS are required for CE's front-end. $assets_to_enqueue = [ 'tribe-events-virtual-admin-css', 'tribe-events-virtual-admin-js', ]; tribe_asset_enqueue( $assets_to_enqueue ); tribe_asset_enqueue_group( Assets::$group_key ); } /** * Handle rendering the Virtual Events meta box. * * @since4.8.0 * * @param int|WP_Post $event Event object or ID. */ public function render_meta_box( $event ) { $data = [ 'event' => $event, ]; tribe_get_template_part( 'community/modules/virtual', null, $data ); } }
Changelog
Version | Description |
---|---|
4.8.0 | Introduced. |
Methods
- enable_for_visitors — When Anonymous Submissions is enabled for CE, make sure it is also enabled for VE.
- enqueue_assets — Handle enqueuing the assets for Virtual Events.
- generate_video_source_placeholder_text — Overwrite placeholder text for video source to correspond with only allowing Youtube and Vimeo (oembed).
- hooks — Setup the hooks for Virtual Events integration.
- manage_possible_autodetect_video_sources — Manage possible video sources for virtual Events.
- manage_possible_video_sources — Manage possible video sources for virtual Events.
- maybe_allow_meeting_link_generation — Maybe allow meeting link generation.
- maybe_remove_share_section — Maybe hide the share section for Virtual Events. The share section is hidden if Community Tickets is not enabled.
- modify_video_sources — Filters the $video_sources variable against the $allowed_sources.
- render_meta_box — Handle rendering the Virtual Events meta box.