File: /mnt/data/dreamstour-wp/wp-content/plugins/dreamstour-widgets/widgets/class-benefit.php
<?php
namespace Dreamstourelementor\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Repeater;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class DTS_benefit extends Widget_Base {
public function get_name() {
return 'dreamstour_elementor_benefit';
}
public function get_title() {
return __( 'Dreams Tour Benefit', 'dreamstour_elementor' );
}
public function get_icon() {
return 'eicon-bullet-list';
}
public function get_categories() {
return [ 'dreamstourelemetortheme' ];
}
protected function register_controls() {
$this->start_controls_section(
'content_section',
[
'label' => __( 'Content', 'dreamstour_elementor' ),
]
);
$this->add_control(
'heading',
[
'label' => __( 'Heading', 'dreamstour_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Our <span class="text-primary text-decoration-underline">Benefits</span> & Key Advantages', 'dreamstour_elementor' ),
]
);
$this->add_control(
'sub_heading',
[
'label' => __( 'Sub Title', 'dreamstour_elementor' ),
'type' => Controls_Manager::TEXTAREA,
'default' => __( 'DreamsTour, a tour operator specializing in dream destinations, offers a variety of benefits for travelers.', 'dreamstour_elementor' ),
]
);
$repeater = new Repeater();
$repeater->add_control(
'icon_class',
[
'label' => __( 'Icon class', 'dreamstour_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => 'isax isax-lock-1',
]
);
$repeater->add_control(
'bg_class',
[
'label' => __( 'Icon background class', 'dreamstour_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => 'bg-secondary text-gray-9',
'description' => __( 'e.g., bg-secondary text-gray-9, bg-orange text-white, bg-purple text-white', 'dreamstour_elementor' ),
]
);
$repeater->add_control(
'card_title',
[
'label' => __( 'Title', 'dreamstour_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'VIP Packages', 'dreamstour_elementor' ),
]
);
$repeater->add_control(
'description',
[
'label' => __( 'Description', 'dreamstour_elementor' ),
'type' => Controls_Manager::TEXTAREA,
'default' => __( 'Include premium seating, meet-and-greet experiences, backstage tours.', 'dreamstour_elementor' ),
]
);
$repeater->add_control(
'accent_class',
[
'label' => __( 'Accent class (icon overlay color)', 'dreamstour_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => 'text-secondary',
]
);
$this->add_control(
'items',
[
'label' => __( 'Benefit Items', 'dreamstour_elementor' ),
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
[
'icon_class' => 'isax isax-lock-1',
'bg_class' => 'bg-secondary text-gray-9',
'card_title' => __( 'VIP Packages', 'dreamstour_elementor' ),
'description' => __( 'Include premium seating, meet-and-greet experiences, backstage tours.', 'dreamstour_elementor' ),
'accent_class' => 'text-secondary',
],
[
'icon_class' => 'isax isax-magicpen',
'bg_class' => 'bg-orange text-white',
'card_title' => __( 'Concert Tickets', 'dreamstour_elementor' ),
'description' => __( 'A centralized place to buy tickets for various dates of the tour', 'dreamstour_elementor' ),
'accent_class' => 'text-orange',
],
[
'icon_class' => 'isax isax-receipt-add',
'bg_class' => 'bg-purple text-white',
'card_title' => __( 'Travel Packages', 'dreamstour_elementor' ),
'description' => __( 'Bundles that include concert tickets, accommodations', 'dreamstour_elementor' ),
'accent_class' => 'text-purple',
],
[
'icon_class' => 'isax isax-location-tick',
'bg_class' => 'bg-teal text-white',
'card_title' => __( 'Best Price Guarantee', 'dreamstour_elementor' ),
'description' => __( 'Such as private rehearsals, soundcheck access,', 'dreamstour_elementor' ),
'accent_class' => 'text-teal',
],
],
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings();
$items = isset($settings['items']) && is_array($settings['items']) ? $settings['items'] : [];
?>
<section class="section benefit-section bg-light-300">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-6 text-center wow fadeInUp" data-wow-delay="0.2s">
<div class="section-header text-center">
<h2 class="mb-2"><?php echo wp_kses_post( $settings['heading'] ); ?></h2>
<p class="sub-title"><?php echo esc_html( $settings['sub_heading'] ); ?></p>
</div>
</div>
</div>
<div class="row g-4">
<?php
$delayIndex = 0;
foreach ( $items as $item ) :
$delayIndex++;
$wowDelay = number_format( 0.1 + ( $delayIndex * 0.1 ), 1 );
?>
<div class="col-sm-6 col-lg-3 d-flex">
<div class="card benefit-card mb-0 flex-fill wow fadeInUp" data-wow-delay="<?php echo esc_attr( $wowDelay ); ?>s">
<div class="card-body text-center">
<div class="benefit-icon mb-2 <?php echo esc_attr( $item['bg_class'] ); ?> mx-auto">
<i class="<?php echo esc_attr( $item['icon_class'] ); ?>"></i>
</div>
<h5 class="mb-2"><?php echo esc_html( $item['card_title'] ); ?></h5>
<p class="mb-0"><?php echo esc_html( $item['description'] ); ?></p>
<span class="icon-view <?php echo esc_attr( $item['accent_class'] ); ?>"><i class="<?php echo esc_attr( $item['icon_class'] ); ?>"></i></span>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</section>
<?php
}
}