File: /mnt/data/dreamssalon-wp/wp-content/plugins/dreamsalon-widgets/widgets/class-about-four.php
<?php
/**
* DS About Four Widget (Purpose & Promise Section)
*
* @since 1.0.0
*/
namespace dreamsalonelementor\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Repeater;
if (!defined('ABSPATH')) {
exit;
}
class DSAboutFour extends Widget_Base
{
public function get_name()
{
return 'dreamsalon-ds-about-four';
}
public function get_title()
{
return __('DS About Four', 'dreamsalon_elementor');
}
public function get_icon()
{
return 'eicon-lightbulb';
}
public function get_categories()
{
return ['dreamsalon'];
}
public function get_script_depends()
{
return ['wowjs'];
}
protected function _register_controls()
{
/**
* Section Header
*/
$this->start_controls_section(
'section_header',
[
'label' => __('Section Header', 'dreamsalon_elementor'),
]
);
$this->add_control(
'section_title',
[
'label' => __('Section Title', 'dreamsalon_elementor'),
'type' => Controls_Manager::TEXT,
'default' => __('Our Purpose & Promise', 'dreamsalon_elementor'),
]
);
$this->add_control(
'section_description',
[
'label' => __('Section Description', 'dreamsalon_elementor'),
'type' => Controls_Manager::TEXTAREA,
'default' => __('At the heart of everything we do is a commitment to enhancing your natural beauty with expert care, creative passion, and an experience that leaves you feeling confident, refreshed, and truly valued.', 'dreamsalon_elementor'),
]
);
$this->end_controls_section();
/**
* Left Image Controls
*/
$this->start_controls_section(
'section_images',
[
'label' => __('Purpose Images', 'dreamsalon_elementor'),
]
);
$this->add_control(
'image_one',
[
'label' => __('Image One', 'dreamsalon_elementor'),
'type' => Controls_Manager::MEDIA,
'default' => ['url' => \Elementor\Utils::get_placeholder_image_src()],
]
);
$this->add_control(
'image_two',
[
'label' => __('Image Two', 'dreamsalon_elementor'),
'type' => Controls_Manager::MEDIA,
'default' => ['url' => \Elementor\Utils::get_placeholder_image_src()],
]
);
$this->add_control(
'image_three',
[
'label' => __('Image Three', 'dreamsalon_elementor'),
'type' => Controls_Manager::MEDIA,
'default' => ['url' => \Elementor\Utils::get_placeholder_image_src()],
]
);
$this->end_controls_section();
/**
* Purpose Items
*/
$this->start_controls_section(
'purpose_items',
[
'label' => __('Purpose Items', 'dreamsalon_elementor'),
]
);
$repeater = new Repeater();
$repeater->add_control(
'icon_image',
[
'label' => __('Icon Image', 'dreamsalon_elementor'),
'type' => Controls_Manager::MEDIA,
'default' => ['url' => \Elementor\Utils::get_placeholder_image_src()],
]
);
$repeater->add_control(
'icon_bg_color',
[
'label' => __('Icon Background Color', 'dreamsalon_elementor'),
'type' => Controls_Manager::COLOR,
'default' => '#0d6efd',
]
);
$repeater->add_control(
'title',
[
'label' => __('Title', 'dreamsalon_elementor'),
'type' => Controls_Manager::TEXT,
'default' => __('Our Mission', 'dreamsalon_elementor'),
]
);
$repeater->add_control(
'description',
[
'label' => __('Description', 'dreamsalon_elementor'),
'type' => Controls_Manager::TEXTAREA,
'default' => __('To become the most trusted and innovative beauty destination in the community where creativity thrives.', 'dreamsalon_elementor'),
]
);
$this->add_control(
'purpose_list',
[
'label' => __('Purpose Items', 'dreamsalon_elementor'),
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
[
'title' => 'Our Mission',
'description' => 'To become the most trusted and innovative beauty destination in the community where creativity thrives.',
'icon_bg_color' => '#0d6efd',
],
[
'title' => 'Our Vision',
'description' => 'To be the most trusted and innovative beauty destination, inspiring confidence and empowering self-expression in every individual.',
'icon_bg_color' => '#6f42c1',
],
[
'title' => 'Our Goals',
'description' => 'Our goal is to provide personalized, high-quality beauty services in a welcoming and stylish environment.',
'icon_bg_color' => '#212529',
],
],
'title_field' => '{{{ title }}}',
]
);
$this->end_controls_section();
/**
* Decorative Elements
*/
$this->start_controls_section(
'decorative_elements',
[
'label' => __('Decorative Elements', 'dreamsalon_elementor'),
]
);
$this->add_control(
'element_one',
[
'label' => __('Element Image 1', 'dreamsalon_elementor'),
'type' => Controls_Manager::MEDIA,
'default' => ['url' => \Elementor\Utils::get_placeholder_image_src()],
]
);
$this->add_control(
'element_two',
[
'label' => __('Element Image 2', 'dreamsalon_elementor'),
'type' => Controls_Manager::MEDIA,
'default' => ['url' => \Elementor\Utils::get_placeholder_image_src()],
]
);
$this->end_controls_section();
}
protected function render()
{
$settings = $this->get_settings_for_display();
?>
<!-- Start Purpose Section -->
<section class="purpose-section section">
<div class="container">
<div class="row align-items-center">
<!-- Left Images -->
<div class="col-lg-6 d-lg-block d-none wow fadeInUp" data-wow-delay="0.2s">
<div class="purpose-img-item">
<?php if (!empty($settings['image_one']['url'])) : ?>
<div class="custom-img-one">
<img src="<?php echo esc_url($settings['image_one']['url']); ?>" alt="purpose-img-1" class="img-fluid">
</div>
<?php endif; ?>
<?php if (!empty($settings['image_two']['url'])) : ?>
<div class="custom-img-two">
<img src="<?php echo esc_url($settings['image_two']['url']); ?>" alt="purpose-img-2" class="img-fluid">
</div>
<?php endif; ?>
<?php if (!empty($settings['image_three']['url'])) : ?>
<div class="custom-img-three">
<img src="<?php echo esc_url($settings['image_three']['url']); ?>" alt="purpose-img-3" class="img-fluid">
</div>
<?php endif; ?>
</div>
</div>
<!-- Right Content -->
<div class="col-lg-6">
<div class="section-header text-lg-start text-center mb-4 wow fadeInUp" data-wow-delay="0.4s">
<h2 class="section-title mb-2"><?php echo esc_html($settings['section_title']); ?></h2>
<p><?php echo esc_html($settings['section_description']); ?></p>
</div>
<?php if (!empty($settings['purpose_list'])) :
$delay = 0.5;
foreach ($settings['purpose_list'] as $item) : ?>
<div class="d-flex align-items-center flex-lg-nowrap flex-wrap gap-3 purpose-item mb-4 wow fadeInUp" data-wow-delay="<?php echo esc_attr($delay); ?>s">
<div class="avatar avatar-lg rounded-circle flex-shrink-0" style="background-color: <?php echo esc_attr($item['icon_bg_color']); ?>;">
<?php if (!empty($item['icon_image']['url'])) : ?>
<img src="<?php echo esc_url($item['icon_image']['url']); ?>" alt="<?php echo esc_attr($item['title']); ?>" class="img-fluid w-auto h-auto">
<?php endif; ?>
</div>
<div>
<h3 class="title mb-2"><?php echo esc_html($item['title']); ?></h3>
<p><?php echo esc_html($item['description']); ?></p>
</div>
</div>
<?php $delay += 0.1;
endforeach;
endif; ?>
</div>
</div>
</div>
<!-- Decorative Elements -->
<?php if (!empty($settings['element_one']['url'])) : ?>
<img src="<?php echo esc_url($settings['element_one']['url']); ?>" alt="purpose-element-1" class="img-fluid element-one spin">
<?php endif; ?>
<?php if (!empty($settings['element_two']['url'])) : ?>
<img src="<?php echo esc_url($settings['element_two']['url']); ?>" alt="purpose-element-2" class="img-fluid element-two floating">
<?php endif; ?>
</section>
<!-- End Purpose Section -->
<?php
}
}