| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
|
| 6 |
/** |
| 7 |
* Elementor integration for the chatbot placement widget (plan 95dd1e, part 2). |
| 8 |
* |
| 9 |
* Registration happens ONLY inside Elementor's own `elementor/widgets/register` |
| 10 |
* hook (Elementor >= 3.5): when Elementor is absent — or too old to fire that |
| 11 |
* hook — nothing further loads, so there is no fatal and no ghost widget. The |
| 12 |
* Widget_Base subclass lives in its own file required from the callback below, |
| 13 |
* which is why this always-loaded file must never reference an Elementor class. |
| 14 |
*/ |
| 15 |
class MxChat_Elementor { |
| 16 |
|
| 17 |
public static function init() { |
| 18 |
add_action('elementor/widgets/register', array(__CLASS__, 'register_widget')); |
| 19 |
} |
| 20 |
|
| 21 |
/** |
| 22 |
* @param \Elementor\Widgets_Manager $widgets_manager Passed by Elementor. |
| 23 |
*/ |
| 24 |
public static function register_widget($widgets_manager) { |
| 25 |
require_once __DIR__ . '/class-mxchat-elementor-widget.php'; |
| 26 |
$widgets_manager->register(new MxChat_Elementor_Widget()); |
| 27 |
} |
| 28 |
} |
| 29 |
|