File: /mnt/data/dreamspos-uk/wp-content/plugins/dreamslanding-widgets/widgets/class-dl-commitment.php
<?php
namespace Dreamslandingelementor\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Repeater;
use Elementor\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class DTS_dl_commitment extends Widget_Base {
public function get_name() {
return 'dreamslanding_dl_commitment';
}
public function get_title() {
return __( 'DL Commitment', 'dreamslanding_elementor' );
}
public function get_icon() {
return 'eicon-bullet-list';
}
public function get_categories() {
return [ 'dreamslandingelemetortheme' ];
}
public function get_script_depends() {
return [ 'dreamslandingelementor-elementor' ];
}
protected function register_controls() {
// Section content
$this->start_controls_section(
'section_content',
[
'label' => __( 'Content', 'dreamslanding_elementor' ),
]
);
$this->add_control(
'section_title',
[
'label' => __( 'Section Title', 'dreamslanding_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Our Commitment to You', 'dreamslanding_elementor' ),
]
);
$this->add_control(
'section_image',
[
'label' => __( 'Right Image', 'dreamslanding_elementor' ),
'type' => Controls_Manager::MEDIA,
'default' => [ 'url' => Utils::get_placeholder_image_src() ],
]
);
$this->end_controls_section();
// Commitment items
$this->start_controls_section(
'section_items',
[
'label' => __( 'Commitment Items', 'dreamslanding_elementor' ),
]
);
$repeater = new Repeater();
$repeater->add_control(
'item_title',
[
'label' => __( 'Item Title', 'dreamslanding_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Transparent Communication', 'dreamslanding_elementor' ),
]
);
$repeater->add_control(
'item_description',
[
'label' => __( 'Item Description', 'dreamslanding_elementor' ),
'type' => Controls_Manager::TEXTAREA,
'default' => __( 'No hidden fees, no surprise charges, no confusing terms. What you see is what you get.', 'dreamslanding_elementor' ),
]
);
$this->add_control(
'items',
[
'label' => __( 'Items', 'dreamslanding_elementor' ),
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
[
'item_title' => __( 'Transparent Communication', 'dreamslanding_elementor' ),
'item_description' => __( 'No hidden fees, no surprise charges, no confusing terms. What you see is what you get.', 'dreamslanding_elementor' ),
],
[
'item_title' => __( 'Continuous Improvement', 'dreamslanding_elementor' ),
'item_description' => __( 'We release new features and improvements regularly based on customer feedback. Your suggestions shape our roadmap.', 'dreamslanding_elementor' ),
],
[
'item_title' => __( 'Data Ownership', 'dreamslanding_elementor' ),
'item_description' => __( 'Your data is your data. Export it anytime, keep it forever. No lock-in, no hostage situations.', 'dreamslanding_elementor' ),
],
[
'item_title' => __( 'Long-Term Support', 'dreamslanding_elementor' ),
'item_description' => __( "We're building a company that will support your business for decades, not just years. Your trust is our most valuable asset.", 'dreamslanding_elementor' ),
],
],
'title_field' => '{{{ item_title }}}',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
$section_title = ! empty( $settings['section_title'] ) ? $settings['section_title'] : __( 'Our Commitment to You', 'dreamslanding_elementor' );
$section_image = isset( $settings['section_image']['url'] ) ? $settings['section_image']['url'] : '';
$items = ! empty( $settings['items'] ) && is_array( $settings['items'] ) ? $settings['items'] : [];
?>
<!-- Choose Section / Commitment -->
<section class="choose-section">
<div class="container">
<div class="section-header text-center aos" data-aos="fade-up">
<?php if ( $section_title ) : ?>
<h2><?php echo esc_html( $section_title ); ?></h2>
<?php endif; ?>
</div>
<div class="row">
<div class="col-lg-6 aos" data-aos="fade-up">
<div class="choose-img">
<?php if ( $section_image ) : ?>
<img src="<?php echo esc_url( $section_image ); ?>" class="img-fluid" alt="Choose">
<?php endif; ?>
</div>
</div>
<div class="col-lg-6">
<div class="choose-content">
<?php
if ( ! empty( $items ) ) {
foreach ( $items as $item ) {
$title = isset( $item['item_title'] ) ? $item['item_title'] : '';
$desc = isset( $item['item_description'] ) ? $item['item_description'] : '';
?>
<div class="choose-grid aos" data-aos="fade-up">
<div class="row">
<div class="col-md-5">
<?php if ( $title ) : ?>
<h4><?php echo esc_html( $title ); ?></h4>
<?php endif; ?>
</div>
<div class="col-md-7">
<?php if ( $desc ) : ?>
<p><?php echo esc_html( $desc ); ?></p>
<?php endif; ?>
</div>
</div>
</div>
<?php
}
}
?>
</div>
</div>
</div>
</div>
</section>
<!-- /Choose Section -->
<?php
}
}