AmeliaBookingElementorWidget.php
2 years ago
AmeliaCatalogBookingElementorWidget.php
1 year ago
AmeliaCatalogElementorWidget.php
2 years ago
AmeliaEventsCalendarBookingElementorWidget.php
1 year ago
AmeliaEventsElementorWidget.php
2 years ago
AmeliaEventsListBookingElementorWidget.php
2 years ago
AmeliaStepBookingElementorWidget.php
2 years ago
ElementorBlock.php
2 years ago
ElementorBlock.php
81 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @copyright © TMS-Plugins. All rights reserved. |
| 4 | * @licence See LICENCE.md for license details. |
| 5 | */ |
| 6 | |
| 7 | namespace AmeliaBooking\Infrastructure\WP\Elementor; |
| 8 | |
| 9 | use Elementor\AmeliaBookingElementorWidget; |
| 10 | use Elementor\AmeliaStepBookingElementorWidget; |
| 11 | use Elementor\AmeliaCatalogBookingElementorWidget; |
| 12 | use Elementor\AmeliaCatalogElementorWidget; |
| 13 | use Elementor\AmeliaEventsElementorWidget; |
| 14 | use Elementor\AmeliaEventsListBookingElementorWidget; |
| 15 | use Elementor\Plugin; |
| 16 | |
| 17 | /** |
| 18 | * Class ElementorBlock |
| 19 | * |
| 20 | * @package AmeliaBooking\Infrastructure\WP\Elementor |
| 21 | */ |
| 22 | class ElementorBlock |
| 23 | { |
| 24 | |
| 25 | protected static $instance; |
| 26 | |
| 27 | public static function get_instance() |
| 28 | { |
| 29 | if (!isset(static::$instance)) { |
| 30 | static::$instance = new static; |
| 31 | } |
| 32 | |
| 33 | return static::$instance; |
| 34 | } |
| 35 | |
| 36 | protected function __construct() |
| 37 | { |
| 38 | add_action('elementor/editor/before_enqueue_scripts', [$this, 'widget_styles']); |
| 39 | add_action('elementor/widgets/register', [$this, 'register_widgets']); |
| 40 | add_action('elementor/frontend/after_enqueue_styles', [$this, 'widget_styles']); |
| 41 | add_action('elementor/elements/categories_registered', [$this, 'register_widget_categories']); |
| 42 | } |
| 43 | |
| 44 | public function includes() |
| 45 | { |
| 46 | require_once(AMELIA_PATH . '/src/Infrastructure/WP/Elementor/AmeliaStepBookingElementorWidget.php'); |
| 47 | require_once(AMELIA_PATH . '/src/Infrastructure/WP/Elementor/AmeliaCatalogBookingElementorWidget.php'); |
| 48 | require_once(AMELIA_PATH . '/src/Infrastructure/WP/Elementor/AmeliaBookingElementorWidget.php'); |
| 49 | require_once(AMELIA_PATH . '/src/Infrastructure/WP/Elementor/AmeliaCatalogElementorWidget.php'); |
| 50 | require_once(AMELIA_PATH . '/src/Infrastructure/WP/Elementor/AmeliaEventsElementorWidget.php'); |
| 51 | require_once(AMELIA_PATH . '/src/Infrastructure/WP/Elementor/AmeliaEventsListBookingElementorWidget.php'); |
| 52 | } |
| 53 | |
| 54 | public function register_widgets() |
| 55 | { |
| 56 | $this->includes(); |
| 57 | Plugin::instance()->widgets_manager->register(new AmeliaStepBookingElementorWidget()); |
| 58 | Plugin::instance()->widgets_manager->register(new AmeliaCatalogBookingElementorWidget()); |
| 59 | Plugin::instance()->widgets_manager->register(new AmeliaBookingElementorWidget()); |
| 60 | Plugin::instance()->widgets_manager->register(new AmeliaCatalogElementorWidget()); |
| 61 | Plugin::instance()->widgets_manager->register(new AmeliaEventsElementorWidget()); |
| 62 | Plugin::instance()->widgets_manager->register(new AmeliaEventsListBookingElementorWidget()); |
| 63 | } |
| 64 | |
| 65 | public function widget_styles() |
| 66 | { |
| 67 | wp_register_style('amelia-elementor-widget-font', AMELIA_URL . 'public/css/frontend/elementor.css', array(), AMELIA_VERSION); |
| 68 | wp_enqueue_style('amelia-elementor-widget-font'); |
| 69 | } |
| 70 | |
| 71 | public function register_widget_categories($elements_manager) |
| 72 | { |
| 73 | $elements_manager->add_category( |
| 74 | 'amelia-elementor', |
| 75 | [ |
| 76 | 'title' => 'Amelia', |
| 77 | 'icon' => 'amelia-logo', |
| 78 | ], 1); |
| 79 | } |
| 80 | |
| 81 | } |