HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1017-azure #17~24.04.1-Ubuntu SMP Mon Dec 1 20:10:50 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/dreamstour-wp/wp-content/plugins/dreamstour-widgets/widgets/class-tourism-services.php
<?php
namespace Dreamstourelementor\Widgets;

use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Repeater;

if ( ! defined( 'ABSPATH' ) ) exit;

class DTS_tourism_services extends Widget_Base {

    public function get_name() {
        return 'dreamstour_elementor_tourism_services';
    }

    public function get_title() {
        return __( 'Dreams Tour - Tourism Services', 'dreamstour_elementor' );
    }

    public function get_icon() {
        return 'eicon-info-box';
    }

    public function get_categories() {
        return [ 'dreamstourelemetortheme' ];
    }

    protected function register_controls() {
        $this->start_controls_section('content_section', [ 'label' => __( 'Content', 'dreamstour_elementor' ) ]);

        $this->add_control('section_bg_class', [
            'label' => __( 'Section Classes', 'dreamstour_elementor' ),
            'type' => Controls_Manager::TEXT,
            'default' => 'section bg-light-200 faq-sec',
        ]);

        // Left Heading with inline image
        $this->add_control('left_heading_text_before', [
            'label' => __( 'Left Heading (before image)', 'dreamstour_elementor' ),
            'type' => Controls_Manager::TEXT,
            'default' => __( 'Trusted Solution Of Your', 'dreamstour_elementor' ),
        ]);
        $this->add_control('left_heading_image', [
            'label' => __( 'Left Heading Inline Image', 'dreamstour_elementor' ),
            'type' => Controls_Manager::MEDIA,
            'default' => [ 'url' => '' ],
        ]);
        $this->add_control('left_heading_text_after', [
            'label' => __( 'Left Heading (after image)', 'dreamstour_elementor' ),
            'type' => Controls_Manager::TEXT,
            'default' => __( 'Tourism Services', 'dreamstour_elementor' ),
        ]);

        // Feature cards repeater
        $rep = new Repeater();
        $rep->add_control('border_class', [
            'label' => __( 'Border Class', 'dreamstour_elementor' ),
            'type' => Controls_Manager::TEXT,
            'default' => 'border-secondary',
        ]);
        $rep->add_control('bg_class', [
            'label' => __( 'Background Class', 'dreamstour_elementor' ),
            'type' => Controls_Manager::TEXT,
            'default' => 'bg-secondary-transparent',
        ]);
        $rep->add_control('avatar_bg_class', [
            'label' => __( 'Avatar BG Class', 'dreamstour_elementor' ),
            'type' => Controls_Manager::TEXT,
            'default' => 'bg-secondary',
        ]);
        $rep->add_control('icon_class', [
            'label' => __( 'Icon Class', 'dreamstour_elementor' ),
            'type' => Controls_Manager::TEXT,
            'default' => 'isax isax-lock-1 text-gray-9 fs-20',
        ]);
        $rep->add_control('title', [
            'label' => __( 'Title', 'dreamstour_elementor' ),
            'type' => Controls_Manager::TEXT,
            'default' => __( 'VIP Packages', 'dreamstour_elementor' ),
        ]);
        $rep->add_control('text', [
            'label' => __( 'Text', 'dreamstour_elementor' ),
            'type' => Controls_Manager::TEXTAREA,
            'default' => __( 'Include premium seating, meet-and-greet experiences, backstage tours.', 'dreamstour_elementor' ),
        ]);

        $this->add_control('features', [
            'label' => __( 'Features', 'dreamstour_elementor' ),
            'type' => Controls_Manager::REPEATER,
            'fields' => $rep->get_controls(),
            'default' => [
                [ 'border_class' => 'border-secondary','bg_class' => 'bg-secondary-transparent','avatar_bg_class' => 'bg-secondary','icon_class' => 'isax isax-lock-1 text-gray-9 fs-20','title' => __( 'VIP Packages','dreamstour_elementor' ), 'text' => __( 'Include premium seating, meet-and-greet experiences, backstage tours.', 'dreamstour_elementor' ) ],
                [ 'border_class' => 'border-purple','bg_class' => 'bg-purple-transparent','avatar_bg_class' => 'bg-purple','icon_class' => 'isax isax-receipt-add fs-20','title' => __( 'Travel Packages','dreamstour_elementor' ), 'text' => __( 'Bundles that include concert tickets, accommodations.', 'dreamstour_elementor' ) ],
                [ 'border_class' => 'border-teal','bg_class' => 'bg-teal-transparent','avatar_bg_class' => 'bg-teal','icon_class' => 'isax isax-location-tick fs-20','title' => __( 'Best Price Guarantee','dreamstour_elementor' ), 'text' => __( 'Such as private rehearsals, soundcheck access.', 'dreamstour_elementor' ) ],
            ],
            'title_field' => '{{{ title }}}',
        ]);

        // Right header
        $this->add_control('right_badge', [
            'label' => __( 'Right Badge', 'dreamstour_elementor' ),
            'type' => Controls_Manager::TEXT,
            'default' => __( 'Most Popular Providers', 'dreamstour_elementor' ),
        ]);
        $this->add_control('right_heading', [
            'label' => __( 'Right Heading', 'dreamstour_elementor' ),
            'type' => Controls_Manager::TEXT,
            'default' => __( 'Try Relaxing Accomodations.', 'dreamstour_elementor' ),
        ]);

        // Accordion repeater
        $faq = new Repeater();
        $faq->add_control('question', [
            'label' => __( 'Question', 'dreamstour_elementor' ),
            'type' => Controls_Manager::TEXT,
            'default' => __( 'What types of tours do you offer?', 'dreamstour_elementor' ),
        ]);
        $faq->add_control('answer', [
            'label' => __( 'Answer', 'dreamstour_elementor' ),
            'type' => Controls_Manager::TEXTAREA,
            'default' => __( 'We offer a wide range of tours, including cultural, adventure, luxury, and customized itineraries.', 'dreamstour_elementor' ),
        ]);
        $faq->add_control('answer_2', [
            'label' => __( 'Answer 2 (optional)', 'dreamstour_elementor' ),
            'type' => Controls_Manager::TEXT,
            'default' => __( 'Popular destinations include Europe, Africa (e.g., Morocco), ', 'dreamstour_elementor' ),
        ]);
        $faq->add_control('open', [
            'label' => __( 'Open by default', 'dreamstour_elementor' ),
            'type' => Controls_Manager::SWITCHER,
            'default' => '',
        ]);
        $faq->add_control('wow_delay', [
            'label' => __( 'WOW Delay', 'dreamstour_elementor' ),
            'type' => Controls_Manager::TEXT,
            'default' => '0.2s',
        ]);
        $this->add_control('faqs', [
            'label' => __( 'FAQs', 'dreamstour_elementor' ),
            'type' => Controls_Manager::REPEATER,
            'fields' => $faq->get_controls(),
            'default' => [
                [ 'question' => __( 'What types of tours do you offer?', 'dreamstour_elementor' ), 'answer' => __( 'We offer a wide range of tours, including cultural, adventure, luxury, and customized itineraries.', 'dreamstour_elementor' ), 'answer_2' => __( 'Popular destinations include Europe, Africa (e.g., Morocco), ', 'dreamstour_elementor' ), 'open' => 'yes', 'wow_delay' => '0.2s' ],
                [ 'question' => __( 'Are the tours customizable?', 'dreamstour_elementor' ), 'answer' => __( 'We offer a wide range of tours, including cultural, adventure, luxury, and customized itineraries.', 'dreamstour_elementor' ), 'open' => '', 'wow_delay' => '0.4s' ],
                [ 'question' => __( 'What safety measures do you follow?', 'dreamstour_elementor' ), 'answer' => __( 'We offer a wide range of tours, including cultural, adventure, luxury, and customized itineraries.', 'dreamstour_elementor' ), 'open' => '', 'wow_delay' => '0.6s' ],
                [ 'question' => __( 'How far in advance should I book?', 'dreamstour_elementor' ), 'answer' => __( 'We offer a wide range of tours, including cultural, adventure, luxury, and customized itineraries.', 'dreamstour_elementor' ), 'open' => '', 'wow_delay' => '0.8s' ],
                [ 'question' => __( 'What is your cancellation policy?', 'dreamstour_elementor' ), 'answer' => __( 'We offer a wide range of tours, including cultural, adventure, luxury, and customized itineraries.', 'dreamstour_elementor' ), 'open' => '', 'wow_delay' => '1.0s' ],
            ],
            'title_field' => '{{{ question }}}',
        ]);

        $this->end_controls_section();
    }

    protected function render() {
        $s = $this->get_settings();
        $section_classes = !empty($s['section_bg_class']) ? esc_attr($s['section_bg_class']) : 'section bg-light-200 faq-sec';
        $inline_img = ! empty($s['left_heading_image']['url']) ? $s['left_heading_image']['url'] : get_template_directory_uri() . '/assets/images/placeholder.webp';
        ?>
        <section class="<?php echo $section_classes; ?>">
            <div class="container">
                <div class="row">
                    <div class="col-lg-6">
                        <div class="tourism-text-info">
                            <div class="text-header">
                                <h2>
                                    <?php echo esc_html($s['left_heading_text_before']); ?>
                                    <span class="text-primary">
                                        <img src="<?php echo esc_url($inline_img); ?>" alt="Img">
                                        <?php echo esc_html($s['left_heading_text_after']); ?>
                                    </span>
                                </h2>
                            </div>
                            <?php if ( ! empty( $s['features'] ) ) : foreach ( $s['features'] as $feat ) :
                                $border = esc_attr( $feat['border_class'] );
                                $bg = esc_attr( $feat['bg_class'] );
                                $avbg = esc_attr( $feat['avatar_bg_class'] );
                                $icon = esc_attr( $feat['icon_class'] );
                                ?>
                                <div class="card <?php echo $border; ?> shadow-none <?php echo $bg; ?>">
                                    <div class="card-body d-flex align-items-center">
                                        <span class="avatar <?php echo $avbg; ?> rounded-circle flex-shrink-0">
                                            <i class="<?php echo $icon; ?>"></i>
                                        </span>
                                        <div class="ms-3">
                                            <h5 class="mb-1"><?php echo esc_html( $feat['title'] ); ?></h5>
                                            <p><?php echo esc_html( $feat['text'] ); ?></p>
                                        </div>
                                    </div>
                                </div>
                            <?php endforeach; endif; ?>
                        </div>
                    </div>
                    <div class="col-lg-6">
                        <div class="faq-cards-six">
                            <div class="section-header-six mb-4">
                                <span class="badge badge-soft-primary rounded-pill mb-1"><?php echo esc_html($s['right_badge']); ?></span>
                                <h2><?php echo esc_html($s['right_heading']); ?></h2>
                            </div>
                            <div class="accordion accordion-flush" id="accordionFaq-<?php echo esc_attr($this->get_id()); ?>">
                                <?php if ( ! empty( $s['faqs'] ) ) :
                                    $idx = 1;
                                    foreach ( $s['faqs'] as $item ) :
                                        $open = isset($item['open']) && $item['open'] === 'yes';
                                        $collapse_id = 'faq-collapse-' . $idx . '-' . $this->get_id();
                                        $delay = !empty($item['wow_delay']) ? $item['wow_delay'] : '0.2s';
                                ?>
                                <div class="accordion-item <?php echo $open ? 'show' : ''; ?> wow fadeInUp" data-wow-delay="<?php echo esc_attr($delay); ?>">
                                    <h2 class="accordion-header">
                                        <button class="accordion-button <?php echo $open ? '' : 'collapsed'; ?>" type="button" data-bs-toggle="collapse" data-bs-target="#<?php echo esc_attr($collapse_id); ?>" aria-expanded="<?php echo $open ? 'true' : 'false'; ?>" aria-controls="<?php echo esc_attr($collapse_id); ?>">
                                            <?php echo esc_html( $item['question'] ); ?>
                                        </button>
                                    </h2>
                                    <div id="<?php echo esc_attr($collapse_id); ?>" class="accordion-collapse collapse <?php echo $open ? 'show' : ''; ?>" data-bs-parent="#accordionFaq-<?php echo esc_attr($this->get_id()); ?>">
                                        <div class="accordion-body">
                                            <p class="mb-0"><?php echo esc_html( $item['answer'] ); ?></p>
                                            <?php if ( ! empty( $item['answer_2'] ) ) : ?><p><?php echo esc_html( $item['answer_2'] ); ?></p><?php endif; ?>
                                        </div>
                                    </div>
                                </div>
                                <?php $idx++; endforeach; endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <?php
    }
}