File: /home/xedaptot/public_html/wp-content/plugins/tokoo-extensions/modules/elementor/widgets/banner.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Elementor Banner Widget.
*
* Elementor widget that inserts an embbedable content into the page, from any given URL.
*
* @since 1.0.0
*/
class Tokoo_Elementor_Banner extends Widget_Base {
/**
* Get widget name.
*
* Retrieve Banner widget name.
*
* @since 1.0.0
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'tokoo_banner';
}
/**
* Get widget title.
*
* Retrieve Banner widget title.
*
* @since 1.0.0
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Banner', 'tokoo-extensions' );
}
/**
* Get widget icon.
*
* Retrieve Banner widget icon.
*
* @since 1.0.0
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return 'fa fa-shopping-bag';
}
/**
* Get widget categories.
*
* Retrieve the list of categories the Banner widget belongs to.
*
* @since 1.0.0
* @access public
*
* @return array Widget categories.
*/
public function get_categories() {
return [ 'tokoo-elements' ];
}
/**
* Register Banner 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', 'tokoo-extensions' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'img_src',
[
'name' => 'image',
'label' => esc_html__( 'Image', 'tokoo-extensions' ),
'type' => Controls_Manager::MEDIA,
'placeholder' => esc_html__( 'Upload Banner Image', 'tokoo-extensions' ),
]
);
$this->add_control(
'link',
[
'name' => 'link',
'label' => esc_html__( 'Image Link', 'tokoo-extensions' ),
'type' => Controls_Manager::TEXT,
'input_type' => 'url',
'placeholder' => esc_html__( 'Enter your url here', 'tokoo-extensions' ),
]
);
$this->add_control(
'el_class',
[
'label' => esc_html__( 'Extra class name', 'tokoo-extensions' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'If you wish to style particular content element differently, please add a class name to this field and refer to it in your custom CSS file.', 'tokoo-extensions' ),
]
);
$this->end_controls_section();
}
/**
* Render Banner 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();
extract( $settings );
$args = array(
'img_src' => ( isset( $img_src['id'] ) && $img_src['id'] != 0 ) ? wp_get_attachment_url( $img_src['id'] ) : '',
'link' => isset( $link ) ? $link : '',
'el_class' => isset( $el_class ) ? $el_class : '',
);
if( function_exists( 'tokoo_banner' ) ) {
tokoo_banner( $args );
}
}
}
Plugin::instance()->widgets_manager->register_widget_type( new Tokoo_Elementor_Banner );