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-how-it-works.php
<?php
namespace Dreamstourelementor\Widgets;

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

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

class DTS_how_it_works extends Widget_Base {

    public function get_name() {
        return 'dreamstour-how-it-works';
    }

    public function get_title() {
        return __( 'Dreams Tour How it Works', 'dreamstour_elementor' );
    }

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

    public function get_categories() {
        return array( 'dreamstourelemetortheme' );
    }

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

        $this->add_control(
            'badge_text',
            [
                'label' => __( 'Badge Text', 'dreamstour_elementor' ),
                'type' => Controls_Manager::TEXT,
                'default' => __( 'How it Works', 'dreamstour_elementor' ),
            ]
        );

        $this->add_control(
            'heading_text',
            [
                'label' => __( 'Heading', 'dreamstour_elementor' ),
                'type' => Controls_Manager::TEXT,
                'default' => __( 'Here’s a breakdown of how our services work', 'dreamstour_elementor' ),
            ]
        );

        $this->add_control(
            'top_bg_image',
            [
                'label' => __( 'Top Background Image (for ::before)', 'dreamstour_elementor' ),
                'type' => Controls_Manager::MEDIA,
                'default' => [ 'url' => '' ],
                'description' => __( 'Upload the decorative top background image used by .work-section-six::before', 'dreamstour_elementor' ),
            ]
        );

        $repeater = new Repeater();
        $repeater->add_control(
            'bg_class',
            [
                'label' => __( 'Background Wrapper Class', 'dreamstour_elementor' ),
                'type' => Controls_Manager::TEXT,
                'default' => 'bg-teal-trans',
                'description' => __( 'e.g., bg-teal-trans, bg-prime-trans, bg-purple-trans', 'dreamstour_elementor' ),
            ]
        );
        $repeater->add_control(
            'icon_class',
            [
                'label' => __( 'Icon Class', 'dreamstour_elementor' ),
                'type' => Controls_Manager::TEXT,
                'default' => 'isax isax-buildings-25',
                'description' => __( 'Icon classes, e.g., isax isax-buildings-25', 'dreamstour_elementor' ),
            ]
        );
        $repeater->add_control(
            'icon_color_class',
            [
                'label' => __( 'Icon Color Class', 'dreamstour_elementor' ),
                'type' => Controls_Manager::TEXT,
                'default' => 'text-teal',
                'description' => __( 'e.g., text-teal, text-primary, text-purple', 'dreamstour_elementor' ),
            ]
        );
        $repeater->add_control(
            'step_number',
            [
                'label' => __( 'Step Number', 'dreamstour_elementor' ),
                'type' => Controls_Manager::TEXT,
                'default' => '01',
            ]
        );
        $repeater->add_control(
            'title',
            [
                'label' => __( 'Title', 'dreamstour_elementor' ),
                'type' => Controls_Manager::TEXT,
                'default' => __( 'Checking Availability', 'dreamstour_elementor' ),
            ]
        );
        $repeater->add_control(
            'description',
            [
                'label' => __( 'Description', 'dreamstour_elementor' ),
                'type' => Controls_Manager::TEXTAREA,
                'default' => __( 'Ensure that the tour is available on the dates you plan to travel. Browse available tours in your destination.', 'dreamstour_elementor' ),
            ]
        );
        $repeater->add_control(
            'wow_delay',
            [
                'label' => __( 'WOW Delay (seconds)', 'dreamstour_elementor' ),
                'type' => Controls_Manager::TEXT,
                'default' => '1.5',
            ]
        );

        $this->add_control(
            'items',
            [
                'label' => __( 'Steps', 'dreamstour_elementor' ),
                'type' => Controls_Manager::REPEATER,
                'fields' => $repeater->get_controls(),
                'default' => [
                    [
                        'bg_class' => 'bg-teal-trans',
                        'icon_class' => 'isax isax-buildings-25',
                        'icon_color_class' => 'text-teal',
                        'step_number' => '01',
                        'title' => __( 'Checking Availability', 'dreamstour_elementor' ),
                        'description' => __( 'Ensure that the tour is available on the dates you plan to travel. Browse available tours in your destination.', 'dreamstour_elementor' ),
                        'wow_delay' => '1.5',
                    ],
                    [
                        'bg_class' => 'bg-prime-trans',
                        'icon_class' => 'isax isax-calendar-edit5',
                        'icon_color_class' => 'text-primary',
                        'step_number' => '02',
                        'title' => __( 'Booking & Confirmation', 'dreamstour_elementor' ),
                        'description' => __( 'Upon arrival, check in at our reception. Our friendly staff will guide you through', 'dreamstour_elementor' ),
                        'wow_delay' => '1.5',
                    ],
                    [
                        'bg_class' => 'bg-purple-trans',
                        'icon_class' => 'isax isax-direct-send5',
                        'icon_color_class' => 'text-purple',
                        'step_number' => '03',
                        'title' => __( 'Enjoy Your Stay', 'dreamstour_elementor' ),
                        'description' => __( 'Make sure to be at the meeting point on time, Ask questions and enjoy the experience!', 'dreamstour_elementor' ),
                        'wow_delay' => '1.5',
                    ],
                ],
            ]
        );

        $this->end_controls_section();
    }

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

        $uid = 'work-section-six-' . $this->get_id();

        // Scoped style for ::before background image
        if ( ! empty( $s['top_bg_image']['url'] ) ) {
            $bg = esc_url( $s['top_bg_image']['url'] );
            echo '<style>#' . esc_attr( $uid ) . '.work-section-six{position:relative;}#' . esc_attr( $uid ) . '.work-section-six::before{background-image:url(' . $bg . ');}</style>';
        }

        echo '<section id="' . esc_attr( $uid ) . '" class="section work-section-six">';
        echo '  <div class="container">';
        echo '    <div class="row align-items-center">';

        echo '      <div class="col-xxl-3 col-lg-4">';
        echo '        <div class="section-header-six mb-0 wow fadeInUp" data-wow-delay="1.5">';
        echo '          <span class="badge badge-soft-primary rounded-pill mb-1">' . esc_html( $s['badge_text'] ) . '</span>';
        echo '          <h2>' . esc_html( $s['heading_text'] ) . '<span class="text-primary">.</span></h2>';
        echo '        </div>';
        echo '      </div>';

        echo '      <div class="col-xxl-9 col-lg-8">';
        echo '        <div class="row align-items-center">';

        if ( ! empty( $s['items'] ) && is_array( $s['items'] ) ) {
            foreach ( $s['items'] as $item ) {
                $bg_class = ! empty( $item['bg_class'] ) ? $item['bg_class'] : 'bg-teal-trans';
                $icon_class = ! empty( $item['icon_class'] ) ? $item['icon_class'] : 'isax isax-buildings-25';
                $icon_color = ! empty( $item['icon_color_class'] ) ? $item['icon_color_class'] : 'text-teal';
                $step = ! empty( $item['step_number'] ) ? $item['step_number'] : '';
                $title = ! empty( $item['title'] ) ? $item['title'] : '';
                $desc = ! empty( $item['description'] ) ? $item['description'] : '';
                $delay = ! empty( $item['wow_delay'] ) ? $item['wow_delay'] : '1.5';

                echo '          <div class="col-md-4 col-sm-6">';
                echo '            <div class="' . esc_attr( $bg_class ) . ' mb-4 wow fadeInUp" data-wow-delay="' . esc_attr( $delay ) . '">';
                echo '              <div class="card border-0 mb-0">';
                echo '                <div class="card-body">';
                echo '                  <div class="d-flex align-items-center justify-content-between mb-3">';
                echo '                    <span class="work-icon ' . esc_attr( $icon_color ) . ' d-flex"><i class="' . esc_attr( $icon_class ) . '"></i></span>';
                echo '                    <span class="work-avatar">' . esc_html( $step ) . '</span>';
                echo '                  </div>';
                echo '                  <div>';
                echo '                    <h5 class="mb-2' . ( $title === 'Checking Availability' ? ' text-truncate' : '' ) . '">' . esc_html( $title ) . '</h5>';
                echo '                    <p class="text-truncate line-clamb-3">' . esc_html( $desc ) . '</p>';
                echo '                  </div>';
                echo '                </div>';
                echo '              </div>';
                echo '            </div>';
                echo '          </div>';
            }
        }

        echo '        </div>'; // row
        echo '      </div>'; // right column

        echo '    </div>'; // row align-items-center
        echo '  </div>'; // container
        echo '</section>';
    }
}