} /** * Enqueues the assets for the widgets in the Elementor preview. * Just enqueues them all, as any could be added/removed while editing. * * @since 6.4.0 */ public function enqueue_preview_styles() { foreach ( $this->get_widgets() as $widget ) { tribe( $widget )->enqueue_style(); } } /** * Enqueue frontend resources. * * @since 6.4.0 */ public function enqueue_frontend_resources(): void { tribe_asset_enqueue( 'tribe-events-v2-single-skeleton' ); tribe_asset_enqueue( 'tribe-events-v2-single-skeleton-full' ); tribe_asset_enqueue( 'tec-events-elementor-widgets-base-styles' ); do_action( 'tec_events_elementor_enqueue_frontend_assets', $this ); } /** * Dynamically enqueues the styles for the rendered TEC widget. * * @since 6.4.0 * * @param Abstract_Widget $widget The widget instance. */ public function action_enqueue_widget_styles( $widget ) { $name = $widget->get_name(); if ( ! $name ) { return; } $widgets = $this->get_widgets(); // Not one of ours. if ( strpos( $name, 'tec_events_elementor_widget_' ) === false ) { return; } if ( ! method_exists( $widget, 'enqueue_style' ) ) { return; } tribe( $widget )->enqueue_style(); } /** * Registers icon styles for Elementor. * * @since 6.4.0 */ public function action_register_editor_styles(): void { // setting this to enqueue on elementor/editor/after_enqueue_styles fails, so we run it separately, below. tribe_asset( tribe( 'tec.main' ), 'tec-events-elementor-icons', 'integrations/plugins/elementor/icons.css', [], null, [ 'groups' => [ static::$icon_group_key ], ] ); /** * Fires after the Elementor editor (icon) styles have been registered. * * @since 6.4.0 * * @param Assets_Manager $this The assets manager instance. */ do_action( 'tec_events_elementor_register_editor_styles', $this ); } /** * Enqueues icon styles for Elementor. * * @since 6.4.0 */ public function action_enqueue_editor_styles(): void { tribe_asset_enqueue_group( static::$icon_group_key ); } /** * Enqueues the Elementor stylesheet for a single event page if a specific Elementor template is set. * Note this stylesheet is programmatically created by Elementor and stored in the uploads directory. * * @since 6.4.0 */ public function enqueue_single_event_template_styles(): void { // Bail if we are not on a single event page. if ( ! tribe( Template_Bootstrap::class )->is_single_event() ) { return; } $event_id = get_the_ID(); // No event ID? Bail. if ( ! is_numeric( $event_id ) ) { return; } $template = tribe( Importer::class )->get_template( Event_Single_Static::class ); if ( null === $template ) { return; } $upload_dir = wp_upload_dir(); wp_enqueue_style( 'elementor-event-template-' . $template->ID, $upload_dir['baseurl'] . '/elementor/css/post-' . $template->ID . '.css', [], \Tribe__Events__Main::VERSION ); } }