<?php
namespace EcafeAddons\Widgets;

use Elementor\Widget_Base;
use Elementor\Controls_Manager;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

wp_enqueue_style( 'ecafe-tippy-css', ECAFE_ASSETS_PATH . 'css/baharni/tippy.min.css', array(), ECAFE_VERSION, false );
wp_register_script( 'ecafe-popper-js', ECAFE_ASSETS_PATH . 'js/baharni/popper.min.js', array( 'jquery' ), ECAFE_VERSION, false );
wp_register_script( 'ecafe-tippy-js-3rd', ECAFE_ASSETS_PATH . 'js/baharni/tippy-bundle.umd.min.js', array( 'ecafe-popper-js' ), ECAFE_VERSION, false );
wp_register_script( 'ecafe-tippy-js', ECAFE_ASSETS_PATH . 'js/custom/ecafe-tippy-custom.min.js', array( 'ecafe-popper-js', 'ecafe-tippy-js-3rd' ), ECAFE_VERSION, false );
wp_enqueue_script( 'ecafe-tippy-js' );
$tippyclass = 'ec-tippy-tooltip';

$tippyTooltipContent       = ! empty( $settings['tippyTooltipContent'] ) ? esc_attr( $settings['tippyTooltipContent'] ) : 'Tooltip';
$tippyTooltipTheme         = ! empty( $settings['tippyTooltipTheme'] ) ? esc_attr( $settings['tippyTooltipTheme'] ) : 'light';
$tippyTooltipPlacements    = ! empty( $settings['tippyTooltipPlacements'] ) ? esc_attr( $settings['tippyTooltipPlacements'] ) : 'top';
$tippyTooltipArrows        = ( isset( $settings['tippyTooltipArrows'] ) && $settings['tippyTooltipArrows'] == 'yes' ) ? $settings['tippyTooltipArrows'] : '';
$tippyTooltipAnimations    = ! empty( $settings['tippyTooltipAnimations'] ) ? esc_attr( $settings['tippyTooltipAnimations'] ) : 'fade';
$tippyTooltipInDuration    = ! empty( $settings['tippyTooltipInDuration'] ) ? esc_attr( $settings['tippyTooltipInDuration'] ) : 0;
$tippyTooltipOutDuration   = ! empty( $settings['tippyTooltipOutDuration'] ) ? esc_attr( $settings['tippyTooltipOutDuration'] ) : 0;
$tippyTooltipSkid          = ! empty( $settings['tippyTooltipSkid'] ) ? esc_attr( $settings['tippyTooltipSkid'] ) : 0;
$tippyTooltipDistance      = ! empty( $settings['tippyTooltipDistance'] ) ? esc_attr( $settings['tippyTooltipDistance'] ) : 0;
$tippyTooltipTriggers      = ! empty( $settings['tippyTooltipTriggers'] ) ? esc_attr( $settings['tippyTooltipTriggers'] ) : 'mouseenter';
$tippyTooltipInteractivity = ( isset( $settings['tippyTooltipInteractivity'] ) && $settings['tippyTooltipInteractivity'] == 'yes' ) ? $settings['tippyTooltipInteractivity'] : '';
$tippyTooltipFollowCursor  = ( isset( $settings['tippyTooltipFollowCursor'] ) && $settings['tippyTooltipFollowCursor'] == 'yes' ) ? $settings['tippyTooltipFollowCursor'] : '';

$this->add_render_attribute( 'ec_tippy', 'data-tippy-content', $tippyTooltipContent, true );
$this->add_render_attribute( 'ec_tippy', 'data-tippy-theme', $tippyTooltipTheme, true );
$this->add_render_attribute( 'ec_tippy', 'data-tippy-placements', $tippyTooltipPlacements, true );
$this->add_render_attribute( 'ec_tippy', 'data-tippy-arrows', $tippyTooltipArrows, true );
$this->add_render_attribute( 'ec_tippy', 'data-tippy-animations', $tippyTooltipAnimations, true );
$this->add_render_attribute( 'ec_tippy', 'data-tippy-induration', $tippyTooltipInDuration, true );
$this->add_render_attribute( 'ec_tippy', 'data-tippy-outduration', $tippyTooltipOutDuration, true );
$this->add_render_attribute( 'ec_tippy', 'data-tippy-skid', $tippyTooltipSkid, true );
$this->add_render_attribute( 'ec_tippy', 'data-tippy-distance', $tippyTooltipDistance, true );
$this->add_render_attribute( 'ec_tippy', 'data-tippy-triggers', $tippyTooltipTriggers, true );
$this->add_render_attribute( 'ec_tippy', 'data-tippy-interactivity', $tippyTooltipInteractivity, true );
$this->add_render_attribute( 'ec_tippy', 'data-tippy-follow-cursor', $tippyTooltipFollowCursor, true );

$tippyrender = $this->get_render_attribute_string( 'ec_tippy' );
