navasena/wp-content/plugins/thinkai-plugin/elementor/elementor.php

95 lines
1.8 KiB
PHP
Raw Normal View History

2024-07-31 13:12:38 +07:00
<?php
namespace THINKAIPLUGIN\Element;
class Elementor {
static $widgets = array(
//Home Page One
'banner',
'hero_title',
'service_card',
'feature_carousel',
'marquee_text',
'float_image',
'button',
'funfacts',
'project_masonry',
'testimonial_carousel',
'faqs',
'blog_grid',
//Home Page Two
'clients_carousel',
'newsletter',
'icon_box',
'dashboard_image',
'wave_image',
'trending_voices',
'our_cases',
'about_us',
'google_review',
'testimonial_review',
'feature_services',
'pricing_plan',
'insta_gallery',
//Home Page Five
'video_banner',
'project_card',
'video_tabs',
'blog_carousel',
'team_grid',
'coming_soon',
'blog_list_view',
'contact_us',
);
static function init() {
add_action( 'elementor/init', array( __CLASS__, 'loader' ) );
add_action( 'elementor/elements/categories_registered', array( __CLASS__, 'register_cats' ) );
}
static function loader() {
foreach ( self::$widgets as $widget ) {
$file = THINKAIPLUGIN_PLUGIN_PATH . '/elementor/' . $widget . '.php';
if ( file_exists( $file ) ) {
require_once $file;
}
add_action( 'elementor/widgets/widgets_registered', array( __CLASS__, 'register' ) );
}
}
static function register( $elemntor ) {
foreach ( self::$widgets as $widget ) {
$class = '\\THINKAIPLUGIN\\Element\\' . ucwords( $widget );
if ( class_exists( $class ) ) {
$elemntor->register_widget_type( new $class );
}
}
}
static function register_cats( $elements_manager ) {
$elements_manager->add_category(
'thinkai',
[
'title' => esc_html__( 'Thinkai', 'thinkai' ),
'icon' => 'fa fa-plug',
]
);
$elements_manager->add_category(
'templatepath',
[
'title' => esc_html__( 'Template Path', 'thinkai' ),
'icon' => 'fa fa-plug',
]
);
}
}
Elementor::init();