template_instance = Premium_Template_Tags::getInstance(); return $this->template_instance; } /** * Enqueue scripts. * * Registers required dependencies for the extension and enqueues them. * * @since 1.6.5 * @access public */ public function enqueue_scripts() { if ( ! wp_script_is( 'lottie-js', 'enqueued' ) ) { wp_enqueue_script( 'lottie-js' ); } if ( ! wp_script_is( 'pa-tweenmax', 'enqueued' ) ) { wp_enqueue_script( 'pa-tweenmax' ); } if ( ! wp_script_is( 'tooltipster-bundle', 'enqueued' ) ) { wp_enqueue_script( 'tooltipster-bundle' ); } if ( ! wp_script_is( 'pa-gTooltips', 'enqueued' ) ) { wp_enqueue_script( 'pa-gTooltips' ); } } /** * Enqueue styles. * * Registers required dependencies for the extension and enqueues them. * * @since 2.6.5 * @access public */ public function enqueue_styles() { if ( ! wp_style_is( 'tooltipster', 'enqueued' ) ) { wp_enqueue_style( 'tooltipster' ); } if ( ! wp_style_is( 'pa-gTooltips', 'enqueued' ) ) { wp_enqueue_style( 'pa-gTooltips' ); } } /** * Register Global Tooltip controls. * * @since 1.0.0 * @access public * @param object $element for current element. */ public function register_controls( $element ) { $tab = 'common' !== $element->get_name() ? Controls_Manager::TAB_LAYOUT : Controls_Manager::TAB_CONTENT; $element->start_controls_section( 'section_premium_global_tooltip', array( 'label' => sprintf( ' %s', __( 'Global Tooltip', 'premium-addons-for-elementor' ) ), 'tab' => $tab, ) ); $element->add_control( 'premium_tooltip_update', array( 'label' => '
Update changes to page
', 'type' => Controls_Manager::RAW_HTML, ) ); $element->add_control( 'premium_tooltip_switcher', array( 'label' => __( 'Enable Global Tooltip', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SWITCHER, 'render_type' => 'template', 'return_value' => 'yes', 'prefix_class' => 'premium-global-tooltips-', ) ); $element->add_control( 'pa_tooltip_target', array( 'label' => __( 'CSS Selector', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::TEXT, 'dynamic' => array( 'active' => true, ), 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_control( 'premium_tooltip_notice', array( 'raw' => __( 'Please Note!:', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::RAW_HTML, 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->start_controls_tabs( 'premium_tooltip_tabs' ); $this->add_tooltips_controls( $element ); $this->add_tooltips_style_controls( $element ); $this->add_tooltips_settings_controls( $element ); $element->end_controls_tabs(); $element->end_controls_section(); } /** * Add tooltips content controls. * * @access private * @since 4.10.4 * * @param object $element for current element. */ private function add_tooltips_controls( $element ) { $papro_activated = apply_filters( 'papro_activated', false ); $element->start_controls_tab( 'premium_tooltip_content_tab', array( 'label' => __( 'Content', 'premium-addons-for-elementor' ), 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_control( 'premium_tooltip_type', array( 'label' => __( 'Content', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SELECT, 'render_type' => 'template', 'options' => array( 'text' => __( 'Text', 'premium-addons-for-elementor' ), 'lottie' => __( 'Lottie', 'premium-addons-for-elementor' ), 'gallery' => apply_filters( 'pa_pro_label', __( 'Gallery (PRO)', 'premium-addons-for-elementor' ) ), 'template' => apply_filters( 'pa_pro_label', __( 'Elemenor Template (PRO)', 'premium-addons-for-elementor' ) ), ), 'default' => 'text', 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_control( 'premium_tooltip_text', array( 'label' => __( 'Content Text', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::TEXTAREA, 'render_type' => 'template', 'default' => __( 'Hi, I\'m a global tooltip.', 'premium-addons-for-elementor' ), 'placeholder' => __( 'Hi, I\'m a global tooltip', 'premium-addons-for-elementor' ), 'dynamic' => array( 'active' => true, ), 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type' => 'text', ), ) ); $element->add_control( 'premium_tooltip_icon_switcher', array( 'label' => __( 'Add Icon', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'prefix_class' => 'premium-global-tooltip-', 'render_type' => 'template', 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type' => 'text', ), ) ); $element->add_control( 'premium_tooltip_icon', array( 'label' => __( 'Icon', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::ICONS, 'default' => array( 'value' => 'fas fa-star', 'library' => 'fa-solid', ), 'return_value' => 'yes', 'render_type' => 'template', 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type' => 'text', 'premium_tooltip_icon_switcher' => 'yes', ), ) ); $element->add_control( 'premium_tooltip_lottie_url', array( 'label' => __( 'Animation JSON URL', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::TEXT, 'dynamic' => array( 'active' => true ), 'description' => 'Get JSON code URL from here', 'label_block' => true, 'render_type' => 'template', 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type' => 'lottie', ), ) ); $element->add_control( 'premium_tooltip_lottie_loop', array( 'label' => __( 'Loop', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'true', 'default' => 'true', 'render_type' => 'template', 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type' => 'lottie', ), ) ); $element->add_control( 'premium_tooltip_lottie_reverse', array( 'label' => __( 'Reverse', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'true', 'render_type' => 'template', 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type' => 'lottie', ), ) ); if ( ! $papro_activated ) { $get_pro = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pro', 'editor-page', 'wp-editor', 'get-pro' ); $element->add_control( 'pro_notice', array( 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'This option is available in Premium Addons Pro. ', 'premium-addons-for-elementor' ) . '' . __( 'Upgrade now!', 'premium-addons-for-elementor' ) . '', 'content_classes' => 'papro-upgrade-notice', 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type' => array( 'gallery', 'template' ), ), ) ); } else { do_action( 'pa_tooltips_type_controls', $element ); } $element->add_control( 'hide_tooltip_on', array( 'label' => __( 'Hide Tooltip On', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SELECT2, 'options' => Helper_Functions::get_all_breakpoints(), 'separator' => 'before', 'render' => 'template', 'multiple' => true, 'label_block' => true, 'default' => array(), 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->end_controls_tab(); } /** * Add tooltips style controls. * * @access private * @since 4.10.4 * * @param object $element for current element. */ private function add_tooltips_style_controls( $element ) { /** Start Style Tab. */ $element->start_controls_tab( 'premium_tooltip_style_tab', array( 'label' => __( 'Style', 'premium-addons-for-elementor' ), 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); /** Content Style */ $element->add_control( 'premium_tooltip_content_heading', array( 'label' => __( 'Content', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type!' => 'template', ), ) ); /**Text Style */ $element->add_control( 'premium_tooltip_text_color', array( 'label' => __( 'Text Color', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '.tooltipster-sidetip .tooltipster-box.tooltipster-box-{{ID}} .premium-tooltip-content-wrapper-{{ID}} .premium-tootltip-text' => 'color: {{VALUE}};', ), 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type' => 'text', ), ) ); $element->add_group_control( Group_Control_Typography::get_type(), array( 'name' => 'premium_tooltip_text_typo', 'selector' => '.tooltipster-box.tooltipster-box-{{ID}} .premium-tooltip-content-wrapper-{{ID}} .premium-tootltip-text', 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type' => 'text', ), ) ); $element->add_group_control( Group_Control_Text_Shadow::get_type(), array( 'name' => 'premium_tooltip_text_shadow', 'selector' => '.tooltipster-box.tooltipster-box-{{ID}} .premium-tootltip-text', 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type' => 'text', ), ) ); /**Icon Style */ $element->add_control( 'premium_tooltip_icon_heading', array( 'label' => __( 'Icon', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type' => 'text', 'premium_tooltip_icon_switcher' => 'yes', ), ) ); $element->add_control( 'premium_tooltip_icon_color', array( 'label' => __( 'Icon Color', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '.tooltipster-sidetip .tooltipster-box.tooltipster-box-{{ID}} .premium-tootltip-icon i' => 'color: {{VALUE}};', '.tooltipster-sidetip .tooltipster-box.tooltipster-box-{{ID}} .premium-tootltip-icon svg, .tooltipster-sidetip .tooltipster-box.tooltipster-box-{{ID}} .premium-tootltip-icon svg *' => 'fill: {{VALUE}};', ), 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type' => 'text', 'premium_tooltip_icon_switcher' => 'yes', ), ) ); $element->add_responsive_control( 'premium_tooltip_icon_size', array( 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 0, 'max' => 2000, 'step' => 1, ), ), 'selectors' => array( '.tooltipster-sidetip .tooltipster-box.tooltipster-box-{{ID}} .premium-tootltip-icon i' => 'font-size: {{SIZE}}px;', '.tooltipster-sidetip .tooltipster-box.tooltipster-box-{{ID}} .premium-tootltip-icon svg' => 'width: {{SIZE}}px; height:{{SIZE}}px', ), 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type' => 'text', 'premium_tooltip_icon_switcher' => 'yes', ), ) ); $element->add_group_control( Group_Control_Text_Shadow::get_type(), array( 'name' => 'premium_tooltip_icon_shadow', 'selector' => '.tooltipster-box.tooltipster-box-{{ID}} .premium-tootltip-icon', 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_icon_switcher' => 'yes', 'premium_tooltip_type' => 'text', 'premium_tooltip_icon[library]!' => 'svg', ), ) ); /** Gallery Style */ $element->add_responsive_control( 'premium_tooltip_img_size', array( 'label' => __( 'Size (PX)', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 0, 'max' => 2000, 'step' => 1, ), ), 'default' => array( 'unit' => 'px', 'size' => 100, ), 'selectors' => array( '.tooltipster-sidetip .tooltipster-box.tooltipster-box-{{ID}} .premium-tooltip-gallery, .tooltipster-sidetip .tooltipster-box.tooltipster-box-{{ID}} .premium-tooltip-content-wrapper-{{ID}}, .tooltipster-sidetip .tooltipster-box.tooltipster-box-{{ID}} .premium-tooltip-lottie ' => 'width: {{SIZE}}px; height:{{SIZE}}px', ), 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type' => array( 'gallery', 'lottie' ), ), ) ); $element->add_responsive_control( 'premium_tooltip_img_fit', array( 'label' => __( 'Image Fit', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SELECT, 'options' => array( 'cover' => __( 'Cover', 'premium-addons-for-elementor' ), 'fill' => __( 'Fill', 'premium-addons-for-elementor' ), 'contain' => __( 'Contain', 'premium-addons-for-elementor' ), ), 'default' => 'cover', 'selectors' => array( '.tooltipster-sidetip .tooltipster-box.tooltipster-box-{{ID}} .premium-tooltip-gallery img' => 'object-fit: {{VALUE}};', ), 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_type' => 'gallery', ), ) ); /**Start Container Style */ $element->add_control( 'premium_tooltip_container_heading', array( 'label' => __( 'Container', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_group_control( Group_Control_Background::get_type(), array( 'name' => 'premium_tooltip_container_bg', 'types' => array( 'classic', 'gradient' ), 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), 'selector' => '.tooltipster-box.tooltipster-box-{{ID}}', ) ); $element->add_group_control( Group_Control_Border::get_type(), array( 'name' => 'premium_tooltip_container_border', 'selector' => '.tooltipster-box.tooltipster-box-{{ID}}', ) ); $element->add_control( 'premium_tooltip_container_border_radius', array( 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => array( 'px', 'em', '%' ), 'selectors' => array( '.tooltipster-box.tooltipster-box-{{ID}}' => 'border-radius: {{SIZE}}{{UNIT}}', ), ) ); $element->add_group_control( Group_Control_Box_Shadow::get_type(), array( 'name' => 'premium_tooltip_container_box_shadow', 'selector' => '.tooltipster-sidetip .tooltipster-box.tooltipster-box-{{ID}}', ) ); $element->add_responsive_control( 'premium_tooltip_container_padding', array( 'label' => __( 'Padding', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', 'em', '%' ), 'selectors' => array( '.tooltipster-sidetip div.tooltipster-box-{{ID}} ' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ) ); /** Arrow Style */ $element->add_control( 'premium_tooltip_arrow_heading', array( 'label' => __( 'Arrow', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_arrow' => 'yes', ), ) ); $element->add_control( 'premium_tooltip_arrow_color', array( 'label' => __( 'Arrow Color', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '.premium-tooltipster-base.tooltipster-top .tooltipster-arrow-{{ID}} .tooltipster-arrow-background' => 'border-top-color: {{VALUE}};', '.premium-tooltipster-base.tooltipster-bottom .tooltipster-arrow-{{ID}} .tooltipster-arrow-background' => 'border-bottom-color: {{VALUE}};', '.premium-tooltipster-base.tooltipster-right .tooltipster-arrow-{{ID}} .tooltipster-arrow-background' => 'border-right-color: {{VALUE}};', '.premium-tooltipster-base.tooltipster-left .tooltipster-arrow-{{ID}} .tooltipster-arrow-background' => 'border-left-color: {{VALUE}};', ), 'condition' => array( 'premium_tooltip_switcher' => 'yes', 'premium_tooltip_arrow' => 'yes', ), ) ); $element->end_controls_tab(); } /** * Add tooltips style controls. * * @access private * @since 4.10.4 * * @param object $element for current element. */ private function add_tooltips_settings_controls( $element ) { $element->start_controls_tab( 'premium_tooltip_settings_tab', array( 'label' => __( 'Settings', 'premium-addons-for-elementor' ), 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_control( 'premium_tooltip_mouse_follow', array( 'label' => apply_filters( 'pa_pro_label', __( 'Mouse Follow (PRO)', 'premium-addons-for-elementor' ) ), 'type' => Controls_Manager::SWITCHER, 'render_type' => 'template', 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_control( 'premium_tooltip_interactive', array( 'label' => __( 'Interactive', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SWITCHER, 'description' => __( 'Give users the possibility to interact with the content of the tooltip', 'premium-addons-for-elementor' ), 'default' => 'yes', 'render_type' => 'template', 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_control( 'premium_tooltip_arrow', array( 'label' => __( 'Show Arrow', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), 'render_type' => 'template', 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_control( 'premium_tooltip_trigger', array( 'label' => __( 'Trigger', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SELECT, 'options' => array( 'click' => __( 'Click', 'premium-addons-for-elementor' ), 'hover' => __( 'Hover', 'premium-addons-for-elementor' ), 'viewport' => __( 'On Viewport', 'premium-addons-for-elementor' ), ), 'default' => 'hover', 'render_type' => 'template', 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_control( 'premium_tooltip_position', array( 'label' => __( 'Positon', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::TEXT, 'description' => __( 'Sets the side of the tooltip. The value may one of the following: \'top\', \'bottom\', \'left\', \'right\'. It may also be an array containing one or more of these values. When using an array, the order of values is taken into account as order of fallbacks and the absence of a side disables it', 'premium-addons-for-elementor' ), 'default' => 'top,bottom', 'label_block' => true, 'render_type' => 'template', 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_control( 'premium_tooltip_distance_position', array( 'label' => __( 'Spacing', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::NUMBER, 'title' => __( 'The distance between the origin and the tooltip in pixels, default is 6', 'premium-addons-for-elementor' ), 'default' => 6, 'render_type' => 'template', 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_responsive_control( 'premium_tooltip_min_width', array( 'label' => __( 'Min Width', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SLIDER, 'render_type' => 'template', 'devices' => array( 'desktop', 'tablet', 'mobile' ), 'range' => array( 'px' => array( 'min' => 0, 'max' => 800, ), ), 'description' => __( 'Set a minimum width for the tooltip in pixels, default: 0 (auto width)', 'premium-addons-for-elementor' ), 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_responsive_control( 'premium_tooltip_max_width', array( 'label' => __( 'Max Width', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SLIDER, 'render_type' => 'template', 'range' => array( 'px' => array( 'min' => 0, 'max' => 800, ), ), 'description' => __( 'Set a maximum width for the tooltip in pixels, default: null (no max width)', 'premium-addons-for-elementor' ), 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_responsive_control( 'premium_tooltip_height', array( 'label' => __( 'Height', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => array( 'px', 'em', '%' ), 'render_type' => 'template', 'range' => array( 'px' => array( 'min' => 0, 'max' => 500, ), 'em' => array( 'min' => 0, 'max' => 20, ), ), 'label_block' => true, 'selectors' => array( '.tooltipster-box.tooltipster-box-{{ID}} .tooltipster-content .premium-tooltip-content-wrapper-{{ID}} ' => 'height: {{SIZE}}{{UNIT}};', ), 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_control( 'premium_tooltip_anime', array( 'label' => __( 'Animation', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::SELECT, 'options' => array( 'fade' => __( 'Fade', 'premium-addons-for-elementor' ), 'grow' => __( 'Grow', 'premium-addons-for-elementor' ), 'swing' => __( 'Swing', 'premium-addons-for-elementor' ), 'slide' => __( 'Slide', 'premium-addons-for-elementor' ), 'fall' => __( 'Fall', 'premium-addons-for-elementor' ), ), 'default' => 'fade', 'render_type' => 'template', 'label_block' => true, 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_control( 'premium_tooltip_anime_dur', array( 'label' => __( 'Animation Duration', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::NUMBER, 'title' => __( 'Set the animation duration in milliseconds, default is 350', 'premium-addons-for-elementor' ), 'default' => 350, 'render_type' => 'template', 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_control( 'premium_tooltip_delay', array( 'label' => __( 'Delay', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::NUMBER, 'title' => __( 'Set the animation delay in milliseconds, default is 10' ), 'default' => 10, 'render_type' => 'template', 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->add_control( 'pa_tooltip_zindex', array( 'label' => __( 'Z-Index', 'premium-addons-for-elementor' ), 'type' => Controls_Manager::NUMBER, 'description' => __( 'Set the z-index of the tooltip. Default is 9999999' ), 'render_type' => 'template', 'condition' => array( 'premium_tooltip_switcher' => 'yes', ), ) ); $element->end_controls_tab(); } /** * Render Global badge output in the editor. * * Written as a Backbone JavaScript template and used to generate the live preview. * * @since 2.2.8 * @access public * * @param object $template for current template. * @param object $element for current element. */ public function print_template( $template, $element ) { if ( ! $template && 'widget' === $element->get_type() ) { return; } $old_template = $template; ob_start(); ?> <# var isEnabled = 'yes' === settings.premium_tooltip_switcher ? true : false; if ( isEnabled ) { var type = settings.premium_tooltip_type, tooltipContent = {}; view.addRenderAttribute( 'gTooltipshtml', { id: 'tooltip_content-' + view.getID(), class: 'premium-global-tooltip-content premium-tooltip-content-wrapper-' + view.getID(), }); view.addRenderAttribute( 'gTooltipTemp', { class: 'premium-gtooltips-temp premium-global-tooltips-wrapper-temp-' + view.getID(), style: 'display: none' }); if ( 'template' === type ) { var templateTitle = '' === settings.premium_tooltip_template ? settings.live_temp_content : settings.premium_tooltip_template; view.addRenderAttribute( 'gTooltipshtml', { 'data-template-id': templateTitle, }); } #>
<# switch ( type ) { case 'text': #> {{{settings.premium_tooltip_text}}} <# if ( 'yes' === settings.premium_tooltip_icon_switcher ) { var tooltipIconHTML = elementor.helpers.renderIcon( view, settings.premium_tooltip_icon, { 'aria-hidden': true }, 'i' , 'object'); view.addRenderAttribute( 'gTooltipsIconHolder', { class: 'premium-tootltip-icon', }); #> {{{tooltipIconHTML.value}}} <# } #> <# break; case 'gallery': var gallery = settings.premium_tooltip_gallery; if( ! gallery[0] ) break; tooltipContent = gallery; view.addRenderAttribute( 'gTooltipsGallery', { src: gallery[0]['url'], }); #> <# break; case 'lottie': view.addRenderAttribute( 'gTooltipsLottie', { class: 'premium-lottie-animation premium-tooltip-lottie', 'data-lottie-url': settings.premium_tooltip_lottie_url, 'data-lottie-loop': settings.premium_tooltip_lottie_loop, 'data-lottie-reverse': settings.premium_tooltip_lottie_reverse, }); #>
<# break; } #>
<# var maxWidth = { desktop: '' !== settings.premium_tooltip_max_width.size ? settings.premium_tooltip_max_width.size : null, mobile: '' !== settings.premium_tooltip_max_width_mobile.size ? settings.premium_tooltip_max_width_mobile.size : null, tablet: '' !== settings.premium_tooltip_max_width_tablet.size ? settings.premium_tooltip_max_width_tablet.size : null, }, minWidth = { desktop: '' !== settings.premium_tooltip_min_width.size ? settings.premium_tooltip_min_width.size : 0, mobile: '' !== settings.premium_tooltip_min_width_mobile.size ? settings.premium_tooltip_min_width_mobile.size : 0, tablet: '' !== settings.premium_tooltip_min_width_tablet.size ? settings.premium_tooltip_min_width_tablet.size : 0, }, tooltip_settings = { type: type, content: tooltipContent, minWidth: minWidth, maxWidth: maxWidth, zindex: settings.pa_tooltip_zindex, target: settings.pa_tooltip_target, anime: settings.premium_tooltip_anime, trigger: settings.premium_tooltip_trigger, side: settings.premium_tooltip_position, arrow: 'yes' === settings.premium_tooltip_arrow ? true : false, distance: '' !== settings.premium_tooltip_distance_position ? settings.premium_tooltip_distance_position : 6, duration: '' !== settings.premium_tooltip_anime_dur ? settings.premium_tooltip_anime_dur : 350, delay: '' !== settings.premium_tooltip_anime_delay ? settings.premium_tooltip_anime_delay : 10, hideOn: settings.hide_tooltip_on, }; if( settings.pa_tooltip_class ) { tooltip_settings.uniqueClass = settings.pa_tooltip_class; tooltip_settings.follow_mouse = '' != settings.pa_tooltip_class && 'yes' === settings.premium_tooltip_mouse_follow; if ( '' != settings.pa_tooltip_class ) { tooltip_settings.isTourStarter = 'yes' === settings.is_tour_starter; } } else { tooltip_settings.follow_mouse = 'yes' === settings.premium_tooltip_mouse_follow; } tooltip_settings.interactive = tooltip_settings.follow_mouse ? false : 'yes' === settings.premium_tooltip_interactive; if ( '' !== settings.pa_tooltip_class ) { tooltip_settings.isTourStarter = 'yes' === settings.is_tour_starter; } view.addRenderAttribute( 'gTooltips', { 'id': 'premium-global-tooltips-' + view.getID(), 'class': 'premium-global-tooltips-wrapper', 'data-tooltip_settings': JSON.stringify( tooltip_settings ) }); #>
<# } #> get_type(); $elem_id = $element->get_id(); $id = apply_filters( 'pa_tooltips_dynamic', false ) ? rand( 0, 1000 ) : $elem_id; $settings = $element->get_settings_for_display(); $papro_activated = apply_filters( 'papro_activated', false ); if ( ! $papro_activated && ( 'gallery' === $settings['premium_tooltip_type'] || 'template' === $settings['premium_tooltip_type'] || 'yes' === $settings['premium_tooltip_mouse_follow'] ) ) { return; } $tooltips_enabled = $settings['premium_tooltip_switcher']; if ( 'yes' === $tooltips_enabled ) { $type = $settings['premium_tooltip_type']; $content = ''; ?> ! empty( $settings['premium_tooltip_min_width']['size'] ) ? $settings['premium_tooltip_min_width']['size'] : 0, 'mobile' => ! empty( $settings['premium_tooltip_min_width_mobile']['size'] ) ? $settings['premium_tooltip_min_width_mobile']['size'] : 0, 'tablet' => ! empty( $settings['premium_tooltip_min_width_tablet']['size'] ) ? $settings['premium_tooltip_min_width_tablet']['size'] : 0, ); $max_width = array( 'desktop' => ! empty( $settings['premium_tooltip_max_width']['size'] ) ? $settings['premium_tooltip_max_width']['size'] : null, 'mobile' => ! empty( $settings['premium_tooltip_max_width_mobile']['size'] ) ? $settings['premium_tooltip_max_width_mobile']['size'] : null, 'tablet' => ! empty( $settings['premium_tooltip_max_width_tablet']['size'] ) ? $settings['premium_tooltip_max_width_tablet']['size'] : null, ); $tooltip_settings = array( // escape it all 'type' => $type, 'content' => $content, // needs escaping 'minWidth' => $min_width, 'maxWidth' => $max_width, 'zindex' => $settings['pa_tooltip_zindex'], 'target' => $settings['pa_tooltip_target'], 'anime' => $settings['premium_tooltip_anime'], 'trigger' => $settings['premium_tooltip_trigger'], 'side' => $settings['premium_tooltip_position'], 'arrow' => 'yes' === $settings['premium_tooltip_arrow'], 'distance' => ! empty( $settings['premium_tooltip_distance_position'] ) ? $settings['premium_tooltip_distance_position'] : 6, 'duration' => ! empty( $settings['premium_tooltip_anime_dur'] ) ? $settings['premium_tooltip_anime_dur'] : 350, 'delay' => ! empty( $settings['premium_tooltip_anime_delay'] ) ? $settings['premium_tooltip_anime_delay'] : 10, 'hideOn' => $settings['hide_tooltip_on'], 'elemID' => $elem_id, ); if ( isset( $settings['pa_tooltip_class'] ) ) { $tooltip_settings['uniqueClass'] = $settings['pa_tooltip_class']; $tooltip_settings['follow_mouse'] = empty( $settings['pa_tooltip_class'] ) && 'yes' === $settings['premium_tooltip_mouse_follow']; if ( ! empty( $settings['pa_tooltip_class'] ) ) { $tooltip_settings['isTourStarter'] = 'yes' === $settings['is_tour_starter']; } } else { $tooltip_settings['follow_mouse'] = 'yes' === $settings['premium_tooltip_mouse_follow']; } $tooltip_settings['interactive'] = $tooltip_settings['follow_mouse'] ? false : 'yes' === $settings['premium_tooltip_interactive']; $element->add_render_attribute( '_wrapper', 'data-tooltip-id', $id ); $element->add_render_attribute( '_wrapper', 'data-tooltip_settings', wp_json_encode( $tooltip_settings ) ); $element->add_render_attribute( 'gTooltips_temps' . $id, array( 'id' => 'premium-global-tooltips-temp-' . esc_attr( $id ), 'data-tooltip_settings' => wp_json_encode( $tooltip_settings ), ) ); if ( 'widget' === $element_type && \Elementor\Plugin::instance()->editor->is_edit_mode() ) { ?>
get_render_attribute_string( 'gTooltips_temps' . $id ) ); ?>>
get_active_settings(); if ( ! empty( $settings['premium_tooltip_switcher'] ) ) { $this->enqueue_styles(); $this->enqueue_scripts(); self::$load_script = true; remove_action( 'elementor/frontend/before_render', array( $this, 'check_script_enqueue' ) ); } } /** * Creates and returns an instance of the class * * @since 4.2.5 * @access public * * @return object */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } }