File: /mnt/data/doccure-wp/wp-content/plugins/doccure-elementor/widgets/class-aboutbanner.php
<?php
/**
* Doccure Elementor Address Box 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;
if ( ! defined( 'ABSPATH' ) ) {
// Exit if accessed directly.
exit;
}
/**
* Awesomesauce widget class.
*
* @since 1.0.0
*/
class FlipBannerAbout extends Widget_Base {
/**
* Retrieve the widget name.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'doccure-flip-bannerabout';
}
/**
* Retrieve the widget title.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return __( 'About Us Banner', 'doccure_elementor' );
}
/**
* Retrieve the widget icon.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return 'eicon-featured-image';
}
/**
* 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(
'section_content',
array(
'label' => __( 'Content', 'doccure_elementor' ),
)
);
$this->add_control(
'title',
array(
'label' => __( 'Title', 'doccure_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Title', 'doccure_elementor' ),
)
);
$this->add_control(
'content',
array(
'label' => __( 'Content', 'doccure_elementor' ),
'type' => Controls_Manager::WYSIWYG,
'default' => __( 'Text after hover', 'doccure_elementor' ),
)
);
$this->add_control(
'background',
[
'label' => __( 'Choose Image 1', 'doccure_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->add_control(
'background_one',
[
'label' => __( 'Choose Image 2', 'doccure_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$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();
?>
<div class="aboutuspage_imgsection">
<div class="row">
<div class="col-md-6">
<h2><?php echo esc_html($settings['title']); ?> </h2>
<?php echo $settings['content']; ?>
</div>
<div class="col-md-6">
<div class="position-relative">
<div class="aboutimage_one"> <img src="<?php echo esc_url($settings['background']['url']); ?>" class="img-fluid "></div>
<div class="aboutimage_two"> <img src="<?php echo esc_url($settings['background_one']['url']); ?>" class="img-fluid "></div>
</div>
</div>
</div>
</div>
<?php
}
}