File: /var/www/ecom/wp-content/plugins/electro-extensions/modules/elementor/widgets/feature-block.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Elementor Features Block Widget.
*
* Elementor widget that inserts an embbedable content into the page, from any given URL.
*
* @since 1.0.0
*/
class Electro_Elementor_Features_Block extends Widget_Base {
/**
* Get widget name.
*
* Retrieve Features Block widget name.
*
* @since 1.0.0
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'electro_elementor_feature_block';
}
/**
* Get widget title.
*
* Retrieve Features Block widget title.
*
* @since 1.0.0
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Features Block', 'electro-extensions' );
}
/**
* Get widget icon.
*
* Retrieve Features Block widget icon.
*
* @since 1.0.0
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return 'eicon-icon-box';
}
/**
* Get widget categories.
*
* Retrieve the list of categories the Features Section widget belongs to.
*
* @since 1.0.0
* @access public
*
* @return array Widget categories.
*/
public function get_categories() {
return [ 'electro-elements' ];
}
/**
* Register Features Block 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', 'electro-extensions' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$repeater = new Repeater();
$repeater->add_control(
'icon',
[
'label' => esc_html__( 'Icon', 'electro-extensions' ),
'type' => Controls_Manager::TEXT,
]
);
$repeater->add_control(
'text',
[
'label' => esc_html__( 'Text', 'electro-extensions' ),
'type' => Controls_Manager::TEXT,
]
);
$this->add_control(
'features',
[
'label' => esc_html__( 'Feature Block', 'electro-extensions' ),
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [],
]
);
$this->end_controls_section();
}
/**
* Render Features Block 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();
if ( $features) {
foreach ( $settings['features'] as $feature ) {
$args[] = array(
'icon' => isset( $feature['icon'] ) ? $feature['icon'] : '',
'text' => isset( $feature['text'] ) ? $feature['text'] : '',
);
}
}
if( function_exists( 'electro_features_list' ) ) {
electro_features_list( $args );
}
}
}
Plugin::instance()->widgets_manager->register( new Electro_Elementor_Features_Block);