File: /mnt/data/doccure-wp/wp-content/plugins/doccure-elementor/widgets/class-why-book-us.php
<?php
/**
* Awesomesauce class.
*
* @category Class
* @package ElementorAwesomesauce
* @subpackage WordPress
* @author Ben Marshall <[email protected]>
* @copyright 2020 Ben Marshall
* @license https://opensource.org/licenses/GPL-3.0 GPL-3.0-only
* @link link(https://www.benmarshall.me/build-custom-elementor-widgets/,
* Build Custom Elementor Widgets)
* @since 1.0.0
* php version 7.3.9
*/
namespace ElementorDoccure\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Utils;
use Elementor\Scheme_Color;
if ( ! defined( 'ABSPATH' ) ) {
// Exit if accessed directly.
exit;
}
/**
* Awesomesauce widget class.
*
* @since 1.0.0
*/
class WhyBookus extends Widget_Base {
/**
* Retrieve the widget name.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'doccure-WhyBookus';
}
/**
* Retrieve the widget title.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return __( 'Doccure Why Book With Us', 'doccure_elementor' );
}
/**
* Retrieve the widget icon.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return 'eicon-slides';
}
/**
* Retrieve the list of categories the widget belongs to.
*
* Used to determine where to display the widget in the editor.
*
* Note that currently Elementor supports only one category.
* When multiple categories passed, Elementor uses the first one.
*
* @since 1.0.0
*
* @access public
*
* @return array Widget categories.
*/
public function get_categories() {
return array( 'doccure' );
}
/**
* Register the widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @since 1.0.0
*
* @access protected
*/
protected function register_controls() {
$this->start_controls_section(
'content_section',
[
'label' => esc_html__( 'Content', 'doccure_elementor' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'title',
[
'label' => esc_html__( 'Title', 'doccure_elementor' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__( 'We are committed to understanding your', 'doccure_elementor' ),
'label_block' => true,
]
);
$this->add_control(
'color_title',
[
'label' => esc_html__( 'Color-Title', 'doccure_elementor' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__( 'unique needs and delivering care', 'doccure_elementor' ),
'label_block' => true,
]
);
$this->add_control(
'sub_title',
[
'label' => esc_html__( 'Sub-Title', 'doccure_elementor' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__( 'Why Book With Us', 'doccure_elementor' ),
'label_block' => true,
]
);
$this->add_control(
'sub_title_description',
[
'label' => esc_html__( 'Description ', 'doccure_elementor' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__( 'As a trusted healthAs a trusted healthcare provider in our community, we are passionate about promoting health and wellness beyond the clinic. We actively engage in community outreach programs, health fairs, and educational workshop.', 'doccure_elementor' ),
'label_block' => true,
]
);
$this->add_control(
'shape_1',
[
'label' => __( 'Choose Image', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->add_control(
'shape_2',
[
'label' => __( 'Choose Image', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->add_control(
'shape_3',
[
'label' => __( 'Choose Image', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_toggle',
[
'label' => esc_html__( 'Accordian Right', 'doccure_elementor' ),
]
);
$repeater = new \Elementor\Repeater();
$repeater->add_control(
'tab_title',
[
'label' => esc_html__( 'Title', 'doccure_elementor' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__( 'Appliance', 'doccure_elementor' ),
'label_block' => true,
]
);
$repeater->add_control(
'tab_content',
array(
'label' => __( 'Content', 'doccure_elementor' ),
'type' => Controls_Manager::TEXTAREA,
'default' => __( 'content here', 'doccure_elementor' ),
)
);
$this->add_control(
'tabs',
[
'label' => esc_html__( 'Toggle Items', 'doccure_elementor' ),
'type' => \Elementor\Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
'tab_title' => esc_html__( 'Appliance', 'doccure_elementor' ),
],
'title_field' => '{{{ tab_title }}}',
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_toggle2',
[
'label' => esc_html__( 'Accordian Bottom', 'doccure_elementor' ),
]
);
$repeater = new \Elementor\Repeater();
$repeater->add_control(
'tab_title',
[
'label' => esc_html__( 'Title', 'doccure_elementor' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__( 'Appliance', 'doccure_elementor' ),
'label_block' => true,
]
);
$repeater->add_control(
'tab_iconclass',
[
'label' => esc_html__( 'Icon Class', 'doccure_elementor' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__( 'isax isax-search-normal5', 'doccure_elementor' ),
'label_block' => true,
'description' => esc_html__( 'Enter the CSS class for the icon. For example: "isax isax-search-normal5".', 'doccure_elementor' ),
]
);
$repeater->add_control(
'tab_content',
array(
'label' => __( 'Content', 'doccure_elementor' ),
'type' => Controls_Manager::TEXTAREA,
'default' => __( 'content here', 'doccure_elementor' ),
)
);
$repeater->add_control(
'tab_iconback',
[
'label' => __( 'Icon Background', 'plugin-domain' ),
'type' => \Elementor\Controls_Manager::COLOR,
'default' => '#ff0000', // Default color (red)
]
);
$this->add_control(
'tabs1one',
[
'label' => esc_html__( 'Toggle Items', 'doccure_elementor' ),
'type' => \Elementor\Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
'tab_title' => esc_html__( 'Appliance', 'doccure_elementor' ),
],
'title_field' => '{{{ tab_title }}}',
]
);
$this->end_controls_section();
}
/**
* Render the widget output on the frontend.
*
* Written in PHP and used to generate the final HTML.
*
* @since 1.0.0
*
* @access protected
*/
protected function render() {
$settings = $this->get_settings_for_display();
$id_int = substr( $this->get_id_int(), 0, 3 );
$this->add_inline_editing_attributes( 'title', 'none' );
$this->add_inline_editing_attributes( 'sub_title', 'none' );
?>
<section class="bookus-section bg-dark">
<div class="container">
<div class="row align-items-center row-gap-4">
<div class="col-lg-6">
<div class="bookus-img">
<div class="row g-3">
<div class="col-md-12 aos" data-aos="fade-up">
<?php if(isset($settings['shape_1']['url']) && !empty(isset($settings['shape_1']['url']))){ ?>
<img src="<?php echo esc_url($settings['shape_1']['url']); ?>" class="img-fluid" alt="">
<?php } ?>
</div>
<div class="col-sm-6 aos" data-aos="fade-up">
<?php if(isset($settings['shape_2']['url']) && !empty(isset($settings['shape_2']['url']))){ ?>
<img src="<?php echo esc_url($settings['shape_2']['url']); ?>" class="img-fluid" alt="">
<?php } ?>
</div>
<div class="col-sm-6 aos" data-aos="fade-up">
<?php if(isset($settings['shape_3']['url']) && !empty(isset($settings['shape_3']['url']))){ ?>
<img src="<?php echo esc_url($settings['shape_3']['url']); ?>" class="img-fluid" alt="">
<?php } ?>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="section-header sec-header-one mb-2 aos" data-aos="fade-up">
<span class="badge badge-primary"><?php echo $settings['sub_title']; ?></span>
<h2 class="text-white"><?php echo $settings['title']; ?><span class="text-primary-gradient"> <?php echo $settings['color_title']; ?></span></h2>
</div>
<p class="text-light mb-4"><?php echo $settings['sub_title_description']; ?></p>
<div class="faq-info aos" data-aos="fade-up">
<div class="accordion" id="faq-details">
<?php
foreach ( $settings['tabs'] as $index => $item ) :
$tab_count = $index + 1;
$tab_title_setting_key = $this->get_repeater_setting_key( 'tab_title', 'tabs', $index );
$tab_content_setting_key = $this->get_repeater_setting_key( 'tab_content', 'tabs', $index );
?>
<div class="accordion-item">
<h2 class="accordion-header" id="headingOne_<?php echo $tab_count; ?>">
<a href="javascript:void(0);" class="accordion-button <?php echo $tab_count === 1 ? '' : 'collapsed'; ?>"
data-bs-toggle="collapse"
data-bs-target="#collapseOne_<?php echo $tab_count; ?>"
aria-expanded="<?php echo $tab_count === 1 ? 'true' : 'false'; ?>"
aria-controls="collapseOne_<?php echo $tab_count; ?>">
<?php echo $item['tab_title']; ?>
</a>
</h2>
<div id="collapseOne_<?php echo $tab_count; ?>"
class="accordion-collapse collapse <?php echo $tab_count === 1 ? 'show' : ''; ?>"
aria-labelledby="headingOne_<?php echo $tab_count; ?>"
data-bs-parent="#faq-details">
<div class="accordion-body">
<div class="accordion-content">
<p><?php echo $item['tab_content']; ?></p>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
<div class="bookus-sec">
<div class="row g-4">
<?php
foreach ( $settings['tabs1one'] as $index => $item ) :
$tab_count = $index + 1;
$tab_title_setting_key = $this->get_repeater_setting_key( 'tab_title', 'tabs1one', $index );
$tab_content_setting_key = $this->get_repeater_setting_key( 'tab_content', 'tabs1one', $index );
?>
<div class="col-lg-3">
<div class="book-item">
<div class="book-icon" style="background-color: <?php echo $item['tab_iconback']; ?>">
<i class="<?php echo $item['tab_iconclass']; ?>"></i>
</div>
<div class="book-info">
<h6 class="text-white mb-2"><?php echo $item['tab_title']; ?></h6>
<p class="fs-14 text-light"><?php echo $item['tab_content']; ?></p>
</div>
<div class="way-icon">
<img src="<?php echo esc_url(get_template_directory_uri());?>/assets/images/way-icon.svg" alt="img">
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</section>
<?php
}
}