admin-bar-menu.php
3 years ago
ajax-pagination.php
2 years ago
class-ecs-core.php
2 months ago
class-ecs-module-base.php
1 month ago
class-ecs-modules-manager.php
2 months ago
dynamic-style.php
3 years ago
ecs-dependencies.php
6 years ago
ecs-notices.php
6 years ago
enqueue-styles.php
2 years ago
pro-features.php
2 months ago
pro-preview.php
6 years ago
class-ecs-module-base.php
65 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Abstract base class for all ECS modules. |
| 4 | */ |
| 5 | |
| 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | exit; |
| 8 | } |
| 9 | |
| 10 | abstract class ECS_Module_Base { |
| 11 | |
| 12 | /** Unique snake_case identifier, e.g. 'color_scheme' */ |
| 13 | abstract public function get_id(): string; |
| 14 | |
| 15 | /** Human-readable title shown in the admin UI */ |
| 16 | abstract public function get_title(): string; |
| 17 | |
| 18 | /** Short description shown in the admin UI */ |
| 19 | public function get_description(): string { |
| 20 | return ''; |
| 21 | } |
| 22 | |
| 23 | /** Whether this module is deprecated (legacy) */ |
| 24 | public function is_deprecated(): bool { |
| 25 | return false; |
| 26 | } |
| 27 | |
| 28 | /** Optional migration notice shown on deprecated module cards */ |
| 29 | public function get_deprecated_notice(): string { |
| 30 | return ''; |
| 31 | } |
| 32 | |
| 33 | /** Whether this module requires ECS Pro licence */ |
| 34 | public function is_pro(): bool { |
| 35 | return false; |
| 36 | } |
| 37 | |
| 38 | /** Main entry point called by the modules manager when the module is active */ |
| 39 | abstract public function boot(): void; |
| 40 | |
| 41 | /** Register Elementor widgets — called on elementor/widgets/register */ |
| 42 | public function register_widgets( $widgets_manager ): void {} |
| 43 | |
| 44 | /** Register custom Elementor controls — called on elementor/controls/register */ |
| 45 | public function register_controls( $controls_manager ): void {} |
| 46 | |
| 47 | /** Enqueue frontend assets — called on wp_enqueue_scripts */ |
| 48 | public function enqueue_frontend_assets(): void {} |
| 49 | |
| 50 | /** Enqueue editor-only assets — called on elementor/editor/after_enqueue_scripts */ |
| 51 | public function enqueue_editor_assets(): void {} |
| 52 | |
| 53 | // ------------------------------------------------------------------------- |
| 54 | // Helpers |
| 55 | // ------------------------------------------------------------------------- |
| 56 | |
| 57 | protected function module_path(): string { |
| 58 | return ECS_PATH . 'modules/' . str_replace( '_', '-', $this->get_id() ) . '/'; |
| 59 | } |
| 60 | |
| 61 | protected function module_url(): string { |
| 62 | return ECS_URL . 'modules/' . str_replace( '_', '-', $this->get_id() ) . '/'; |
| 63 | } |
| 64 | } |
| 65 |