PluginProbe
HT Builder – WordPress Theme Builder for Elementor / 1.2.4
HT Builder – WordPress Theme Builder for Elementor v1.2.4
1.3.5 1.3.4 trunk 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.8 1.0.9 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3
ht-builder / classes / class.widgets_control.php

class.widgets_control.php in HT Builder – WordPress Theme Builder for Elementor 1.2.4, at classes/class.widgets_control.php

75 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace HT_Builder\Elementor;
4 use Elementor\Controls_Manager;
5 use Elementor\Element_Base;
6 use Elementor\Controls_Stack;
7 use Elementor\Plugin as Elementor;
8
9 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
10
11 /**
12 * Widgets Control
13 */
14 class HTBuilder_Widgets_Control{
15
16 private static $instance = null;
17 public static function instance() {
18 if ( is_null( self::$instance ) ) {
19 self::$instance = new self();
20 }
21 return self::$instance;
22 }
23
24 function __construct(){
25 $this->init();
26 }
27
28 // Widgets Initialize
29 public function init() {
30
31 // Add Plugin actions
32 add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_widgets' ] );
33 }
34
35 // Widgets Register
36 public function register_widgets() {
37
38 $bl_element = array();
39 $element_manager = array();
40
41 // Builder Element
42 if( htbuilder_get_option( 'enablecustomtemplate', 'htbuilder_templatebuilder_tabs', 'on' ) == 'on' ){
43 $bl_element = array(
44 'bl_post_title',
45 'bl_post_featured_image',
46 'bl_post_meta_info',
47 'bl_post_excerpt',
48 'bl_post_content',
49 'bl_post_comments',
50 'bl_post_search_form',
51 'bl_post_archive',
52 'bl_post_archive_title',
53 'bl_page_title',
54 'bl_site_title',
55 'bl_site_logo',
56 'bl_nav_menu',
57 'bl_post_author_info',
58 );
59 }
60 $element_manager = array_merge( $element_manager, $bl_element );
61
62 // Include Widget files
63 foreach ( $element_manager as $element ){
64 if ( ( htbuilder_get_option( $element, 'htbuilder_element_tabs', 'on' ) === 'on' ) && file_exists(HTBUILDER_PL_PATH.'includes/widgets/'.$element.'.php' ) ){
65 require( HTBUILDER_PL_PATH.'includes/widgets/'.$element.'.php' );
66 $class_name = 'HT_Builder\Elementor\Widget\\'.$element.'_ELement';
67 Elementor::instance()->widgets_manager->register_widget_type( new $class_name() );
68 }
69 }
70
71 }
72
73 }
74
75 HTBuilder_Widgets_Control::instance();