<?php
namespace Elementor;

/**
 * Elementor Widget
 * @package Geroz
 * @since 1.0.0
 */ 
 
class Home4_Expert extends Widget_Base {

	/**
	 * Get widget name.
	 * Retrieve button widget name.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return string Widget name.
	 */
	public function get_name() {
		return 'geroz-home4-expert-widget';
	}

	/**
	 * Get widget title.
	 * Retrieve button widget title.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return string Widget title.
	 */
	public function get_title() {
		return esc_html__( 'Home 4 Expert', 'geroz-core' );
	}

	/**
	 * Get widget icon.
	 * Retrieve button widget icon.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return string Widget icon.
	 */
	public function get_icon() {
		return 'eicon-flash';
	}

	/**
	 * Get widget categories.
	 * Retrieve the list of categories the button widget belongs to.
	 * Used to determine where to display the widget in the editor.
	 *
	 * @since  2.0.0
	 * @access public
	 * @return array Widget categories.
	 */
	public function get_categories()
    {
        return ['geroz_widgets'];
    }
	
	/**
	 * Register button 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->start_controls_section(
			'home4-expert-content',
			[
				'label' => esc_html__( 'Expert Content', 'geroz-core' ),
			]
		);	

		$this->add_control(
			'big_text',
			[
				'label' => esc_html__( 'Big Text', 'geroz-core' ),
				'type' => Controls_Manager::TEXT,
				'default' => esc_html__( '12+ Years of Experience in Lawfirm Services', 'geroz-core' ),
				'label_block' => true,
			]
		);

		$this->add_control(
			'year',
			[
				'label' => esc_html__( 'Year', 'geroz-core' ),
				'type' => Controls_Manager::TEXT,
				'default' => esc_html__( '12', 'geroz-core' ),
				'label_block' => true,
			]
		);

		$this->add_control(
			'year_text',
			[
				'label' => esc_html__( 'Year Text', 'geroz-core' ),
				'type' => Controls_Manager::TEXTAREA,
				'default' => esc_html__( 'YEARS OF EXPERIENCE IN LAW FIRM SERVICES', 'geroz-core' ),
				'label_block' => true,
			]
		);

		$this->add_control(
			'image',
			[
				'label' => esc_html__( 'Image', 'geroz-core' ),
				'type' => Controls_Manager::MEDIA,
				'default' => [
					'url' => Utils::get_placeholder_image_src(),
				],
			]
		);

		$this->add_control(
			'text',
			[
				'label' => esc_html__( 'Text', 'geroz-core' ),
				'type' => Controls_Manager::TEXTAREA,
				'default' => esc_html__( 'Although we are maritime lawyers are proud to help the injured throughout the nation including workers who were working in foreign waters', 'geroz-core' ),
				'label_block' => true,
			]
		);

		$this->add_control(
			'author',
			[
				'label' => esc_html__( 'Author', 'geroz-core' ),
				'type' => Controls_Manager::TEXT,
				'default' => esc_html__( 'William Jekson', 'geroz-core' ),
				'label_block' => true,
			]
		);

		$this->add_control(
			'designation',
			[
				'label' => esc_html__( 'Designation', 'geroz-core' ),
				'type' => Controls_Manager::TEXT,
				'default' => esc_html__( 'Digital Marketer', 'geroz-core' ),
				'label_block' => true,
			]
		);


		$this->end_controls_section();	

	
		}

	/**
	 * Render button widget output on the frontend.
	 * Written in PHP and used to generate the final HTML.
	 *
	 * @since  1.0.0
	 * @access protected
	 */
	protected function render() {
		$settings = $this->get_settings_for_display();
		$allowed_tags = wp_kses_allowed_html('post');
		?>

		<section class="expert-wrapper">
			<h2 class="marquee-title text_invert-3"><?php echo $settings['big_text'];?></h2>
			<div class="container container-1520">
				<div class="row align-items-end justify-content-between">
					<div class="col-xl-2 col-lg-2 col-md-12">
						<div class="experiance has_fade_anim" data-delay="0.5">
							<h2><span><?php echo $settings['year'];?></span><sup>+</sup></h2>
							<p><?php echo $settings['year_text'];?></p>
						</div>
					</div>
					<div class="col-xl-6 col-lg-5 col-md-6">
						<div class="image  has_fade_anim" data-delay="0.7">
							<?php  if ( !empty(esc_url($settings['image']['id']) )) : ?>   
								<img src="<?php echo wp_get_attachment_url($settings['image']['id']);?>" alt=""/>
							<?php endif;?>
						</div>
					</div>
					<div class="col-xl-3 col-lg-4 col-md-6">
						<div class="expeart-infu  has_fade_anim" data-delay="0.9">
							<div class="icon">
								<i class="flaticon-right-quotation-mark"></i>
							</div>
							<p><?php echo $settings['text'];?></p>
							<div class="expeart-intro d-flex align-items-end">
								<div class="name">
									<h5><?php echo $settings['author'];?></h5>
									<span><?php echo $settings['designation'];?></span>
								</div>
								<div class="sing"><?php echo $settings['author'];?></div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</section>

             
		<?php 
	}


}

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