| 1 |
<?php |
| 2 |
|
| 3 |
namespace HelloPlus\Modules\Theme; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; // Exit if accessed directly. |
| 7 |
} |
| 8 |
|
| 9 |
use HelloPlus\Includes\Module_Base; |
| 10 |
|
| 11 |
/** |
| 12 |
* Theme module |
| 13 |
* |
| 14 |
* @package HelloPlus |
| 15 |
* @subpackage HelloPlusModules |
| 16 |
*/ |
| 17 |
class Module extends Module_Base { |
| 18 |
const HELLOPLUS_EDITOR_CATEGORY_SLUG = 'helloplus'; |
| 19 |
|
| 20 |
/** |
| 21 |
* @inheritDoc |
| 22 |
*/ |
| 23 |
public static function get_name(): string { |
| 24 |
return 'theme'; |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* @inheritDoc |
| 29 |
*/ |
| 30 |
protected function get_component_ids(): array { |
| 31 |
return [ |
| 32 |
'Theme_Overrides', |
| 33 |
'Theme_Dependency', |
| 34 |
]; |
| 35 |
} |
| 36 |
|
| 37 |
public function register_styles(): void { |
| 38 |
wp_register_style( |
| 39 |
'helloplus-button', |
| 40 |
HELLOPLUS_STYLE_URL . 'helloplus-button.css', |
| 41 |
[ 'elementor-frontend' ], |
| 42 |
HELLOPLUS_VERSION |
| 43 |
); |
| 44 |
|
| 45 |
wp_register_style( |
| 46 |
'helloplus-image', |
| 47 |
HELLOPLUS_STYLE_URL . 'helloplus-image.css', |
| 48 |
[ 'elementor-frontend' ], |
| 49 |
HELLOPLUS_VERSION |
| 50 |
); |
| 51 |
|
| 52 |
wp_register_style( |
| 53 |
'helloplus-shapes', |
| 54 |
HELLOPLUS_STYLE_URL . 'helloplus-shapes.css', |
| 55 |
[ 'elementor-frontend' ], |
| 56 |
HELLOPLUS_VERSION |
| 57 |
); |
| 58 |
} |
| 59 |
|
| 60 |
/** |
| 61 |
* @param \Elementor\Elements_Manager $elements_manager |
| 62 |
* |
| 63 |
* @return void |
| 64 |
*/ |
| 65 |
public function add_hello_plus_e_panel_categories( \Elementor\Elements_Manager $elements_manager ) { |
| 66 |
$categories = $elements_manager->get_categories(); |
| 67 |
if ( ! empty( $categories[ self::HELLOPLUS_EDITOR_CATEGORY_SLUG ] ) ) { |
| 68 |
return; |
| 69 |
} |
| 70 |
|
| 71 |
$elements_manager->add_category( |
| 72 |
self::HELLOPLUS_EDITOR_CATEGORY_SLUG, |
| 73 |
[ |
| 74 |
'title' => esc_html__( 'Hello+', 'hello-plus' ), |
| 75 |
'icon' => 'fa fa-plug', |
| 76 |
] |
| 77 |
); |
| 78 |
} |
| 79 |
|
| 80 |
/** |
| 81 |
* @inheritDoc |
| 82 |
*/ |
| 83 |
protected function register_hooks(): void { |
| 84 |
parent::register_hooks(); |
| 85 |
add_action( 'elementor/elements/categories_registered', [ $this, 'add_hello_plus_e_panel_categories' ] ); |
| 86 |
add_action( 'elementor/frontend/after_register_styles', [ $this, 'register_styles' ] ); |
| 87 |
} |
| 88 |
} |
| 89 |
|