<?php

/**
 * Elementor Widget
 * @package Meditest
 * @since 1.0.0
 */

namespace Elementor;

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

class meditest_animated_video_icon extends Widget_Base
{

	/**
	 * Get widget name.
	 *
	 * Retrieve Elementor widget name.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @return string Widget name.
	 */
	public function get_name()
	{
		return 'animated-video-icon';
	}

	/**
	 * Get widget title.
	 *
	 * Retrieve Elementor widget title.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @return string Widget title.
	 */
	public function get_title()
	{
		return esc_html__('Animated Video Icon', 'meditest-extra');
	}

	/**
	 * Get widget icon.
	 *
	 * Retrieve Elementor widget icon.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @return string Widget icon.
	 */
	public function get_icon()
	{
		return 'fas fa-th-large';
	}

	/**
	 * Get widget categories.
	 *
	 * Retrieve the list of categories the Elementor widget belongs to.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @return array Widget categories.
	 */
	public function get_categories()
	{
		return ['meditest_widgets'];
	}

	/**
	 * Register Elementor widget controls.
	 *
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @since 1.0.0
	 * @access protected
	 */


	protected function register_controls()
	{
		$this->layout_options();
	}

	/**
	 * Layout Options
	 */
	private function layout_options()
	{


		$this->start_controls_section(
			'layout_option',
			[
				'label' => __('Layout Options', 'meditest-extra'),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
		);


		$this->add_control(
			'video_link',
			[
				'label' => esc_html__('Video URL', 'textdomain'),
				'type' => \Elementor\Controls_Manager::URL,
				'options' => ['url', 'is_external', 'nofollow'],
				'default' => [
					'url' => '',
					'is_external' => true,
					'nofollow' => true,
					// 'custom_attributes' => '',
				],
				'label_block' => true,
			]
		);


		$this->end_controls_section();
	}

	protected function render()
	{

		$settings = $this->get_settings_for_display();


?>


		<div class="animated-video-button">
			<div class="animated-video-icon-content">
				<a class="waves-play-button" href="<?php echo esc_url($settings['video_link']['url']); ?>" data-lity>
					<span class="waves-icon"><i class="ri-play-fill"></i></span>
				</a>
			</div>
		</div>


<?php
	}
}

Plugin::instance()->widgets_manager->register_widget_type(new meditest_animated_video_icon());
