PluginProbe
Hello Plus / 1.2.0
Hello Plus v1.2.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7.0 1.7.1 1.7.2 1.7.3 All 30 releases
hello-plus / modules / content / module.php

module.php in Hello Plus 1.2.0, at modules/content/module.php

133 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace HelloPlus\Modules\Content;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit; // Exit if accessed directly.
7 }
8
9 use Elementor\Controls_Manager;
10 use HelloPlus\Includes\Module_Base;
11 use HelloPlus\Includes\Utils;
12 use HelloPlus\Modules\Content\Classes\Control_Zig_Zag_Animation;
13 use HelloPlus\Modules\Content\Classes\Choose_Img_Control;
14
15 /**
16 * class Module
17 **/
18 class Module extends Module_Base {
19
20 /**
21 * @inheritDoc
22 */
23 public static function get_name(): string {
24 return 'content';
25 }
26
27 /**
28 * @inheritDoc
29 */
30 protected function get_component_ids(): array {
31 return [];
32 }
33
34 /**
35 * @inheritDoc
36 */
37 protected function get_widget_ids(): array {
38 return [
39 'Zig_Zag',
40 'Hero',
41 'CTA',
42 'Flex_Hero',
43 ];
44 }
45
46 /**
47 * @return void
48 */
49 public function register_scripts() {
50 wp_register_script(
51 'helloplus-zigzag-fe',
52 HELLOPLUS_SCRIPTS_URL . 'helloplus-zigzag-fe.js',
53 [ 'elementor-frontend' ],
54 HELLOPLUS_VERSION,
55 true
56 );
57 }
58
59 public function register_styles(): void {
60 wp_register_style(
61 'helloplus-zigzag',
62 HELLOPLUS_STYLE_URL . 'helloplus-zigzag.css',
63 [ 'elementor-frontend' ],
64 HELLOPLUS_VERSION
65 );
66
67 wp_register_style(
68 'helloplus-hero',
69 HELLOPLUS_STYLE_URL . 'helloplus-hero.css',
70 [ 'elementor-frontend' ],
71 HELLOPLUS_VERSION
72 );
73
74 wp_register_style(
75 'helloplus-cta',
76 HELLOPLUS_STYLE_URL . 'helloplus-cta.css',
77 [ 'elementor-frontend' ],
78 HELLOPLUS_VERSION
79 );
80
81 wp_register_style(
82 'helloplus-flex-hero',
83 HELLOPLUS_STYLE_URL . 'helloplus-flex-hero.css',
84 [ 'elementor-frontend' ],
85 HELLOPLUS_VERSION
86 );
87 }
88
89 /**
90 * Load the Module only if Elementor is active.
91 *
92 * @return bool
93 */
94 public static function is_active(): bool {
95 return Utils::is_elementor_active();
96 }
97
98 public function register_controls( Controls_Manager $controls_manager ) {
99 $controls_manager->register( new Control_Zig_Zag_Animation() );
100 $controls_manager->register( new Choose_Img_Control() );
101 }
102
103
104 public function enqueue_editor_styles() {
105 wp_enqueue_style(
106 'helloplus-control-choose-img',
107 HELLOPLUS_STYLE_URL . 'helloplus-control-choose-img.css',
108 [],
109 HELLOPLUS_VERSION
110 );
111 }
112
113 public function enqueue_editor_scripts() {
114 wp_enqueue_script(
115 'helloplus-control-choose-img',
116 HELLOPLUS_SCRIPTS_URL . 'helloplus-control-choose-img.js',
117 [],
118 HELLOPLUS_VERSION,
119 true
120 );
121 }
122
123
124 protected function register_hooks(): void {
125 parent::register_hooks();
126 add_action( 'elementor/frontend/after_register_scripts', [ $this, 'register_scripts' ] );
127 add_action( 'elementor/frontend/after_register_styles', [ $this, 'register_styles' ] );
128 add_action( 'elementor/controls/register', [ $this, 'register_controls' ] );
129 add_action( 'elementor/editor/after_enqueue_styles', [ $this, 'enqueue_editor_styles' ] );
130 add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'enqueue_editor_scripts' ] );
131 }
132 }
133