PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
| Dir : /home/oligap/www/wp-content/themes/woodmart/inc/integrations/elementor/elements/ |
| Server: Linux cloud.virginhosting.lk 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64 IP: 128.140.68.198 |
| Dir : /home/oligap/www/wp-content/themes/woodmart/inc/integrations/elementor/elements/class-sidebar.php |
<?php
/**
* Sidebar element.
*
* @package Woodmart
*/
namespace XTS\Modules\Layouts;
use Elementor\Controls_Manager;
use Elementor\Plugin;
use Elementor\Widget_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Direct access not allowed.
}
/**
* Elementor widget that inserts an embeddable content into the page, from any given URL.
*/
class Sidebar extends Widget_Base {
/**
* Get widget name.
*
* @return string Widget name.
*/
public function get_name() {
return 'wd_sidebar';
}
/**
* Get widget content.
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Sidebar', 'woodmart' );
}
/**
* Get widget icon.
*
* @return string Widget icon.
*/
public function get_icon() {
return 'wd-icon-sa-sidebar';
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @since 2.1.0
* @access public
*
* @return array Widget keywords.
*/
public function get_keywords() {
return array( 'off', 'canvas', 'sidebar' );
}
/**
* Get widget categories.
*
* @return array Widget categories.
*/
public function get_categories() {
return [ 'wd-elements' ];
}
/**
* Register the widget controls.
*/
protected function register_controls() {
global $wp_registered_sidebars;
$options = array();
if ( ! $wp_registered_sidebars ) {
$options[''] = esc_html__( 'No sidebars were found', 'woodmart' );
} else {
$options[''] = esc_html__( 'Choose Sidebar', 'woodmart' );
foreach ( $wp_registered_sidebars as $sidebar_id => $sidebar ) {
$options[ $sidebar_id ] = $sidebar['name'];
}
}
$default_key = array_keys( $options );
$default_key = array_shift( $default_key );
/**
* Content tab
*/
/**
* General settings
*/
$this->start_controls_section(
'general_content_section',
array(
'label' => esc_html__( 'General', 'woodmart' ),
'tab' => Controls_Manager::TAB_CONTENT,
)
);
$this->add_control(
'sidebar_name',
array(
'label' => esc_html__( 'Choose Sidebar', 'elementor' ),
'type' => Controls_Manager::SELECT,
'default' => $default_key,
'options' => $options,
)
);
$this->end_controls_section();
}
/**
* Render the widget output on the frontend.
*/
protected function render() {
$settings = wp_parse_args(
$this->get_settings_for_display(),
array(
'sidebar_name' => '',
)
);
dynamic_sidebar( $settings['sidebar_name'] );
}
}
Plugin::instance()->widgets_manager->register_widget_type( new Sidebar() );