• File: cta-five.php
  • Full Path: /home/slvgwrnz/public_html/wp-content/plugins/prinox-tools/elementor/widgets/cta-five.php
  • Date Modified: 02/05/2025 11:48 AM
  • File size: 7.34 KB
  • MIME-type: text/x-php
  • Charset: utf-8
<?php

/**
 * Elementor Single Widget
 * @package Prinox Tools
 * @since 1.0.0
 */

namespace Elementor;

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

class Prinox_Cta_Five 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 'prionx-cta-5-id';
	}

	/**
	 * Get widget title.
	 *
	 * Retrieve Elementor widget title.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @return string Widget title.
	 */
	public function get_title() {
		return esc_html__( 'Prinox CTA Five', 'prinox-tools' );
	}

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

	/**
	 * 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 [ 'prinox_widgets' ];
	}

	
	protected function register_controls() {

		$this->start_controls_section(
			'prinox_cta_option',
			[
				'label' => esc_html__( 'CTA Option', 'prinox-tools' ),
				'tab'   => Controls_Manager::TAB_CONTENT,
			]
		);
		
		$this->add_control(
			'background_img', [
				'label' => esc_html__( 'Background Image', 'prinox-tools' ),
				'type' => Controls_Manager::MEDIA,
                'label_block' => true,
			]
		);
		
		$this->add_control(
			'title', [
				'label' => esc_html__( 'Title', 'prinox-tools' ),
				'type' => Controls_Manager::TEXTAREA,
                'label_block' => true,
			]
		);
		$this->add_control(
			'description', [
				'label' => esc_html__( 'Description', 'prinox-tools' ),
				'type' => Controls_Manager::TEXTAREA,
                'label_block' => true,
			]
		);
		$this->add_control(
			'btn_label', [
				'label' => esc_html__( 'Button Label', 'prinox-tools' ),
				'type' => Controls_Manager::TEXT,
                'label_block' => true,
			]
		);
		$this->add_control(
			'btn_link', [
				'label' => esc_html__( 'Button Link', 'prinox-tools' ),
				'type' => Controls_Manager::URL,
                'label_block' => true,
			]
		);
       
		$this->end_controls_section();

		$this->start_controls_section(
            'cta_style',
            [
                'label' => __( 'CTA', 'prinox-tools' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );

		
		$this->add_control(
            'title_h',
            [
                'type'      => Controls_Manager::HEADING,
                'label'     => esc_html__( 'Title', 'prinox-tools' ),
                'separator' => 'before',
            ]
        );
		
		$this->add_control(
		    'title_color',
		    [
		        'label'     => esc_html__('Title Color', 'prinox-tools'),
		        'type'      => Controls_Manager::COLOR,
		        'selectors' => [
		            '{{WRAPPER}} .cta-five_title' => 'color: {{VALUE}};',
		        ],
		    ]
		);
		$this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name'           => 'title_typography',
                'label'          => esc_html__( 'Typography', 'prinox-tools' ),
                'selector'       => '{{WRAPPER}} .cta-five_title',
            ]
        );
		
		$this->add_control(
            'content_h',
            [
                'type'      => Controls_Manager::HEADING,
                'label'     => esc_html__( 'Content', 'prinox-tools' ),
                'separator' => 'before',
            ]
        );

		$this->add_control(
		    'content_color',
		    [
		        'label'     => esc_html__('Content Color', 'prinox-tools'),
		        'type'      => Controls_Manager::COLOR,
		        'selectors' => [
		            '{{WRAPPER}} .cta-five_off' => 'color: {{VALUE}};',
		        ],
		    ]
		);
		$this->add_control(
		    'content_cl_color',
		    [
		        'label'     => esc_html__('Stylish Content Color', 'prinox-tools'),
		        'type'      => Controls_Manager::COLOR,
		        'selectors' => [
		            '{{WRAPPER}} .cta-five_off span' => 'color: {{VALUE}};',
		        ],
		    ]
		);
		$this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name'           => 'content_typography',
                'label'          => esc_html__( 'Typography', 'prinox-tools' ),
                'selector'       => '{{WRAPPER}} .cta-five_off',
            ]
        );
		
		$this->end_controls_section();
		
		$this->start_controls_section(
            'btn_style',
            [
                'label' => __( 'Button Style', 'prinox-tools' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );


		$this->add_control(
            'button_h',
            [
                'type'      => Controls_Manager::HEADING,
                'label'     => esc_html__( 'Button', 'prinox-tools' ),
                'separator' => 'before',
            ]
        );
		$this->add_group_control(
			Group_Control_Background::get_type(),
			[
				'name' => 'btn-background',
				'types' => [ 'gradient' ],
				'selector' => '{{WRAPPER}} .btn-style-six',
                'fields_options' => [
                    'background' => [
                        'label' => 'Button Background Color'
                    ],
                ],
			]
		);
		$this->add_group_control(
			Group_Control_Background::get_type(),
			[
				'name' => 'btn-hover-background',
				'types' => [ 'gradient' ],
				'selector' => '{{WRAPPER}} .btn-style-six:before',
                'fields_options' => [
                    'background' => [
                        'label' => 'Button Hover Background Color'
                    ],
                ],
			]
		);
		
		$this->add_control(
		    'button_color',
		    [
		        'label'     => esc_html__('Button Color', 'prinox-tools'),
		        'type'      => Controls_Manager::COLOR,
		        'selectors' => [
		            '{{WRAPPER}} .btn-style-six' => 'color: {{VALUE}};',
		            '{{WRAPPER}} .btn-style-six .btn-wrap .text-two' => 'color: {{VALUE}};',
		        ],
		    ]
		);
		
		$this->end_controls_section();
	}


	protected function render() {
		$settings = $this->get_settings_for_display();	
    
    ?>
    <div class="cta-five">
        <?php if(!empty($settings['background_img']['url'])):?>
		    <div class="cta-five-image_layer" style="background-image: url(<?php echo esc_url($settings['background_img']['url']);?>)"></div>
        <?php endif;?>
		<div class="auto-container">
			<h2 class="cta-five_title"><?php echo wp_kses($settings['title'], true);?></h2>
			<div class="cta-five_off"><?php echo wp_kses($settings['description'], true);?></div>
			<!-- Button Box -->
            <?php if(!empty($settings['btn_label'])):?>
			<div class="cta-five_button-box text-center">
				<a href="<?php echo esc_url($settings['btn_link']['url']);?>" class="theme-btn btn-style-six clearfix">
					<span class="btn-wrap">
						<span class="text-one"><?php echo esc_html($settings['btn_label']);?></span>
						<span class="text-two"><?php echo esc_html($settings['btn_label']);?></span>
					</span>
					<span class="icon flaticon-right-arrow"></span>
				</a>
			</div>
            <?php endif;?>
		</div>
	</div>
    <?php 
    }
		
	
}


Plugin::instance()->widgets_manager->register( new Prinox_Cta_Five() );