Widgets_Manager
Class Widget_Manager
Source
File: src/Tribe/Integrations/Elementor/Widgets_Manager.php
class Widgets_Manager extends Manager_Abstract {
/**
* {@inheritdoc}
*/
protected $type = 'widgets';
/**
* Constructor
*
* @since 5.4.0
*/
public function __construct() {
$this->objects = [
Widgets\Widget_Countdown::get_slug() => Widgets\Widget_Countdown::class,
Widgets\Widget_Event_List::get_slug() => Widgets\Widget_Event_List::class,
Widgets\Widget_Event_Single_Legacy::get_slug() => Widgets\Widget_Event_Single_Legacy::class,
Widgets\Widget_Events_View::get_slug() => Widgets\Widget_Events_View::class,
];
}
/**
* Registers the widgets with Elementor.
*
* @since 5.4.0
*/
public function register() {
$widgets = $this->get_registered_objects();
foreach ( $widgets as $slug => $widget_class ) {
Elementor_Plugin::instance()->widgets_manager->register_widget_type( tribe( $widget_class ) );
}
}
}
Changelog
| Version | Description |
|---|---|
| 5.4.0 | Introduced. |
Methods
- __construct — Constructor
- register — Registers the widgets with Elementor.
- should_swap_legacy — Determine if we should load the legacy widget based on the global query and $post post_type.