• File: breadcrumb.php
  • Full Path: /home/slvgwrnz/public_html/wp-content/plugins/prinox-tools/elementor/widgets/breadcrumb.php
  • Date Modified: 02/05/2025 11:48 AM
  • File size: 6.65 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_Breadcrumb 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-breadcrumb-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 Breadcrumb', '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_faq_option',
			[
				'label' => esc_html__( 'FAQ Option', 'prinox-tools' ),
				'tab'   => Controls_Manager::TAB_CONTENT,
			]
		);

		$this->add_control(
			'br_shape1', [
				'label' => esc_html__( 'Shape 1', 'prinox-tools' ),
				'type' => Controls_Manager::MEDIA,
                'label_block' => true,
			]
		);
		$this->add_control(
			'br_shape2', [
				'label' => esc_html__( 'Shape 2', 'prinox-tools' ),
				'type' => Controls_Manager::MEDIA,
                'label_block' => true,
			]
		);

		$this->add_control(
			'title', [
				'label' => esc_html__( 'Breadcrumb Custom Title', 'prinox-tools' ),
				'type' => Controls_Manager::TEXTAREA,
                'label_block' => true,
			]
		);

		$this->end_controls_section();

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

		$this->add_control(
            'breadcrumb_bg_color',
            [
                'label'     => esc_html__( 'Background Color', 'prinox-tools' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .page-title' => 'background-color: {{VALUE}} ',
                ],
            ]
		);

		$this->add_control(
			'breadcrumb_padding',
			[
				'label' => esc_html__( 'Padding', 'prinox-tools' ),
				'type' => \Elementor\Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%', 'em' ],
				'selectors' => [
					'{{WRAPPER}} .page-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);

		$this->add_control(
            'breadcrumb_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}} .page-title h2' => 'color: {{VALUE}} ',
                ],
            ]
		);

		$this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name'           => 'title_typography',
                'label'          => esc_html__( 'Typography', 'prinox-tools' ),
                'selector'       => '{{WRAPPER}} .page-title h2',
            ]
        );

		$this->add_control(
            'breadcrumb_h',
            [
                'type'      => Controls_Manager::HEADING,
                'label'     => esc_html__( 'Breadcrumb', 'prinox-tools' ),
                'separator' => 'before',
            ]
        );
		$this->add_control(
            'breadcrumb_color',
            [
                'label'     => esc_html__( 'Breadcrumb Color', 'prinox-tools' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .page-title .bread-crumb li' => 'color: {{VALUE}} ',
                    '{{WRAPPER}} .page-title .bread-crumb li::before' => 'color: {{VALUE}} ',
                ],
            ]
		);

		$this->add_control(
            'breadcrumb_link_color',
            [
                'label'     => esc_html__( 'Breadcrumb Link Color', 'prinox-tools' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .page-title .bread-crumb li a' => 'color: {{VALUE}} ',
                ],
            ]
		);

		$this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name'           => 'breadcrumb_typography',
                'label'          => esc_html__( 'Typography', 'prinox-tools' ),
                'selector'       => '{{WRAPPER}} .page-title .bread-crumb li',
            ]
        );

		$this->end_controls_section();
	}


	protected function render() {
		$settings = $this->get_settings_for_display();
		?>

        <!-- Page Title -->
        <section class="page-title">
            <div class="auto-container">
                <!-- Icons Box -->
                <div class="icons-box parallax-scene-1">
                    <div class="icon-one" data-depth="0.10"></div>
                    <?php if(!empty($settings['br_shape1']['url'])):?>
                    <div class="icon-two" data-depth="0.30">
                        <img src="<?php echo esc_url($settings['br_shape1']['url']);?>" alt="" />
                    </div>
                    <?php endif;?>
                    <?php if(!empty($settings['br_shape2']['url'])):?>
                    <div class="icon-three" data-depth="0.30">
                        <img src="<?php echo esc_url($settings['br_shape2']['url']);?>" alt="" />
                    </div>
                    <?php endif;?>
                    <div class="icon-four" data-depth="0.10"></div>
                </div>
                <?php if(!empty($settings['title'])):?>
                    <h2><?php echo wp_kses( $settings['title'], true ); ?></h2>
                <?php else:?>
                    <h2><?php the_title(); ?></h2>
                <?php endif;?>
                <?php echo prinox_the_breadcrumb();?>
            </div>
        </section>
        <!-- End Page Title -->
    <?php
    }


}


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