PluginProbe
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits / 3.1.2
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits v3.1.2
3.2.2 3.2.3 3.2.1 3.2.0 3.1.9 3.1.8 3.1.7 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.9 trunk 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.3 1.1.4 1.1.5 All 174 releases
master-addons / inc / modules / display / shape-divider / shape-divider.php

shape-divider.php in Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits 3.1.2, at inc/modules/display/shape-divider/shape-divider.php

280 lines 11.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace MasterAddons\Modules;
4
5 use Elementor\Controls_Manager;
6 use Elementor\Element_Base;
7 use Elementor\Shapes;
8
9 defined('ABSPATH') || die();
10
11 if (!class_exists('MasterAddons\Modules\Shape_Divider')) {
12 class Shape_Divider
13 {
14
15 public static function init()
16 {
17 add_filter('elementor/shapes/additional_shapes', [__CLASS__, 'additional_shape_divider']);
18 add_action('elementor/element/section/section_shape_divider/before_section_end', [__CLASS__, 'update_shape_list']);
19 }
20
21 public static function update_shape_list(Element_Base $element)
22 {
23 $default_shapes = [];
24 $jltma_shapes_top = [];
25 $jltma_shapes_bottom = [];
26
27 foreach (Shapes::get_shapes() as $shape_name => $shape_props) {
28 if (!isset($shape_props['ha_shape'])) {
29 $default_shapes[$shape_name] = $shape_props['title'];
30 } elseif (!isset($shape_props['ha_shape_bottom'])) {
31 $jltma_shapes_top[$shape_name] = $shape_props['title'];
32 } else {
33 $jltma_shapes_bottom[$shape_name] = $shape_props['title'];
34 }
35 }
36
37 $element->update_control(
38 'shape_divider_top',
39 [
40 'type' => Controls_Manager::SELECT,
41 'groups' => [
42 [
43 'label' => __('Disable', 'master-addons' ),
44 'options' => [
45 '' => __('None', 'master-addons' ),
46 ],
47 ],
48 [
49 'label' => __('Default Shapes', 'master-addons' ),
50 'options' => $default_shapes,
51 ],
52 [
53 'label' => __('Happy Shapes', 'master-addons' ),
54 'options' => $jltma_shapes_top,
55 ],
56 ],
57 ]
58 );
59
60 $element->update_control(
61 'shape_divider_bottom',
62 [
63 'type' => Controls_Manager::SELECT,
64 'groups' => [
65 [
66 'label' => __('Disable', 'master-addons' ),
67 'options' => [
68 '' => __('None', 'master-addons' ),
69 ],
70 ],
71 [
72 'label' => __('Default Shapes', 'master-addons' ),
73 'options' => $default_shapes,
74 ],
75 [
76 'label' => __('Happy Shapes', 'master-addons' ),
77 'options' => array_merge($jltma_shapes_top, $jltma_shapes_bottom),
78 ],
79 ],
80 ]
81 );
82 }
83
84 /**
85 * Undocumented function
86 *
87 * @param array $shape_list
88 * @return void
89 */
90 public static function additional_shape_divider($shape_list)
91 {
92 $jltma_shapes = [
93 'abstract-web' => [
94 'title' => _x('Abstract Web', 'Shapes', 'master-addons' ),
95 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/abstract-web.svg',
96 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/abstract-web.svg',
97 'has_flip' => true,
98 'has_negative' => false,
99 'ha_shape' => true,
100 ],
101 'crossline' => [
102 'title' => _x('Crossline', 'Shapes', 'master-addons' ),
103 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/crossline.svg',
104 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/crossline.svg',
105 'has_flip' => true,
106 'has_negative' => false,
107 'ha_shape' => true,
108 ],
109 'droplet' => [
110 'title' => _x('Droplet', 'Shapes', 'master-addons' ),
111 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/droplet.svg',
112 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/droplet.svg',
113 'has_flip' => true,
114 'has_negative' => true,
115 'ha_shape' => true,
116 ],
117 'flame' => [
118 'title' => _x('Flame', 'Shapes', 'master-addons' ),
119 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/flame.svg',
120 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/flame.svg',
121 'has_flip' => true,
122 'has_negative' => false,
123 'ha_shape' => true,
124 ],
125 'frame' => [
126 'title' => _x('Frame', 'Shapes', 'master-addons' ),
127 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/frame.svg',
128 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/frame.svg',
129 'has_flip' => true,
130 'has_negative' => true,
131 'ha_shape' => true,
132 ],
133 'half-circle' => [
134 'title' => _x('Half Circle', 'Shapes', 'master-addons' ),
135 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/half-circle.svg',
136 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/half-circle.svg',
137 'has_flip' => true,
138 'has_negative' => true,
139 'ha_shape' => true,
140 ],
141 'multi-cloud' => [
142 'title' => _x('Multi Cloud', 'Shapes', 'master-addons' ),
143 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/multi-cloud.svg',
144 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/multi-cloud.svg',
145 'has_flip' => true,
146 'has_negative' => false,
147 'ha_shape' => true,
148 ],
149 'multi-wave' => [
150 'title' => _x('Multi Wave', 'Shapes', 'master-addons' ),
151 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/multi-wave.svg',
152 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/multi-wave.svg',
153 'has_flip' => true,
154 'has_negative' => false,
155 'ha_shape' => true,
156 ],
157 'smooth-zigzag' => [
158 'title' => _x('Smooth Zigzag', 'Shapes', 'master-addons' ),
159 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/smooth-zigzag.svg',
160 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/smooth-zigzag.svg',
161 'has_flip' => true,
162 'has_negative' => false,
163 'ha_shape' => true,
164 ],
165 'splash' => [
166 'title' => _x('Splash', 'Shapes', 'master-addons' ),
167 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/splash.svg',
168 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/splash.svg',
169 'has_flip' => true,
170 'has_negative' => true,
171 'ha_shape' => true,
172 ],
173 'splash2' => [
174 'title' => _x('Splash 2', 'Shapes', 'master-addons' ),
175 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/splash2.svg',
176 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/splash2.svg',
177 'has_flip' => true,
178 'has_negative' => true,
179 'ha_shape' => true,
180 ],
181 'torn-paper' => [
182 'title' => _x('Torn Paper', 'Shapes', 'master-addons' ),
183 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/torn-paper.svg',
184 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/torn-paper.svg',
185 'has_flip' => true,
186 'has_negative' => false,
187 'ha_shape' => true,
188 ],
189 'brush' => [
190 'title' => _x('Brush', 'Shapes', 'master-addons' ),
191 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/brush.svg',
192 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/brush.svg',
193 'has_flip' => true,
194 'has_negative' => true,
195 'ha_shape' => true,
196 ],
197 'sports' => [
198 'title' => _x('Sports', 'Shapes', 'master-addons' ),
199 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/sports.svg',
200 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/sports.svg',
201 'has_flip' => true,
202 'has_negative' => false,
203 'ha_shape' => true,
204 'ha_shape_bottom' => true,
205 ],
206 'landscape' => [
207 'title' => _x('Landscape', 'Shapes', 'master-addons' ),
208 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/landscape.svg',
209 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/landscape.svg',
210 'has_flip' => true,
211 'has_negative' => false,
212 'ha_shape' => true,
213 'ha_shape_bottom' => true,
214 ],
215 'nature' => [
216 'title' => _x('Nature', 'Shapes', 'master-addons' ),
217 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/nature.svg',
218 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/nature.svg',
219 'has_flip' => true,
220 'has_negative' => false,
221 'ha_shape' => true,
222 'ha_shape_bottom' => true,
223 ],
224 'desert' => [
225 'title' => _x('Desert', 'Shapes', 'master-addons' ),
226 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/desert.svg',
227 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/desert.svg',
228 'has_flip' => true,
229 'has_negative' => false,
230 'ha_shape' => true,
231 'ha_shape_bottom' => true,
232 ],
233 'under-water' => [
234 'title' => _x('Under Water', 'Shapes', 'master-addons' ),
235 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/under-water.svg',
236 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/under-water.svg',
237 'has_flip' => true,
238 'has_negative' => false,
239 'ha_shape' => true,
240 'ha_shape_bottom' => true,
241 ],
242 'cityscape-layer' => [
243 'title' => _x('Cityscape Layer', 'Shapes', 'master-addons' ),
244 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/cityscape-layer.svg',
245 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/cityscape-layer.svg',
246 'has_flip' => true,
247 'has_negative' => false,
248 'ha_shape' => true,
249 'ha_shape_bottom' => true,
250 ],
251 'drop' => [
252 'title' => _x('Drop', 'Shapes', 'master-addons' ),
253 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/drop.svg',
254 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/drop.svg',
255 'has_flip' => true,
256 'has_negative' => false,
257 'ha_shape' => true,
258 ],
259 'mosque' => [
260 'title' => _x('Mosque', 'Shapes', 'master-addons' ),
261 'path' => HAPPY_ADDONS_DIR_PATH . 'assets/imgs/shape-divider/mosque.svg',
262 'url' => HAPPY_ADDONS_ASSETS . 'imgs/shape-divider/mosque.svg',
263 'has_flip' => true,
264 'has_negative' => false,
265 'ha_shape' => true,
266 ]
267 ];
268
269 /*
270 * svg path should contain elementor class to show in editor mode
271 */
272 return array_merge($jltma_shapes, $shape_list);
273 }
274 }
275 }
276
277 if (class_exists('MasterAddons\Modules\Shape_Divider')) {
278 Shape_Divider::init();
279 }
280