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