PluginProbe ʕ •ᴥ•ʔ
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 4.0.0
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v4.0.0
4.0.2 4.0.1 4.0.0 3.10.02 3.10.01 3.9.10 3.9.9 3.9.8 3.9.7 3.9.5 3.9.6 3.9.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.3.1 2.3.1.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.4.0 2.5.0 2.5.1 2.5.10 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.2 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.6.0 3.6.1 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.8.1 3.8.2 3.9.0 3.9.1 3.9.2 trunk 1.2.6 1.2.7 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.11 1.5.12 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.0.9.1 2.0.9.2 2.0.9.3
elementskit-lite / widgets / header-offcanvas / header-offcanvas.php
elementskit-lite / widgets / header-offcanvas Last commit date
header-offcanvas-handler.php 6 months ago header-offcanvas.php 3 weeks ago
header-offcanvas.php
936 lines
1 <?php
2 namespace Elementor;
3
4 use \Elementor\ElementsKit_Widget_Header_Offcanvas_Handler as Handler;
5 use \ElementsKit_Lite\Modules\Controls\Controls_Manager as ElementsKit_Controls_Manager;
6 use \ElementsKit_Lite\Modules\Controls\Widget_Area_Utils as Widget_Area_Utils;
7
8 if ( ! defined( 'ABSPATH' ) ) exit;
9
10 class ElementsKit_Widget_Header_Offcanvas extends Widget_Base
11 {
12 use \ElementsKit_Lite\Widgets\Widget_Notice;
13
14 public $base;
15
16 public function get_script_depends() {
17 return ['ekit-header-offcanvas'];
18 }
19
20 public function get_style_depends() {
21 return ['ekit-header-offcanvas'];
22 }
23
24 public function get_name() {
25 return Handler::get_name();
26 }
27
28 public function get_title() {
29 return Handler::get_title();
30 }
31
32 public function get_icon() {
33 return Handler::get_icon();
34 }
35
36 public function get_categories() {
37 return Handler::get_categories();
38 }
39
40 public function get_keywords() {
41 return Handler::get_keywords();
42 }
43
44 public function get_help_url() {
45 return 'https://wpmet.com/doc/header-offcanvas/';
46 }
47
48 protected function is_dynamic_content(): bool {
49 return true;
50 }
51
52 public function has_widget_inner_wrapper(): bool {
53 return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
54 }
55
56 protected function register_controls()
57 {
58
59 $this->start_controls_section(
60 'ekit_header_search',
61 [
62 'label' => esc_html__('Header Offcanvas', 'elementskit-lite'),
63 ]
64 );
65
66 $this->add_control(
67 'ekit_offcanvas_content', [
68 'label' => esc_html__('Content', 'elementskit-lite'),
69 'type' => ElementsKit_Controls_Manager::WIDGETAREA,
70 'label_block' => true,
71 ]
72 );
73
74 $this->add_control(
75 'ekit__offcanvas_seacrh_overlay_bg_color',
76 [
77 'label' =>esc_html__( 'Overlay color', 'elementskit-lite' ),
78 'type' => Controls_Manager::COLOR,
79 'selectors' => [
80 '{{WRAPPER}} .ekit-bg-black' => 'background-color: {{VALUE}};',
81 ],
82 ]
83 );
84
85 // Hamburger and Close tabs
86 $this->start_controls_tabs('ekit_offcanvas_hamburber_close_tabs');
87 // Hamburger tab
88 $this->start_controls_tab(
89 'ekit_offcanvas_hamburger_tab',
90 [
91 'label' => esc_html__( 'Hamburger', 'elementskit-lite' ),
92 ]
93 );
94
95 $this->add_control(
96 'ekit_offcanvas_menu_type',
97 [
98 'label' => esc_html__('Menu Type:', 'elementskit-lite'),
99 'type' => Controls_Manager::SELECT,
100 'default' => 'icon',
101 'options' => [
102 'icon' => esc_html__('Icon', 'elementskit-lite'),
103 'text' => esc_html__('Text', 'elementskit-lite'),
104 'icon_with_text' => esc_html__('Icon with Text', 'elementskit-lite'),
105 ],
106 ]
107 );
108
109 $this->add_control(
110 'ekit_offcanvas_menu_icons',
111 [
112 'label' => esc_html__('Icon', 'elementskit-lite'),
113 'label_block' => true,
114 'type' => Controls_Manager::ICONS,
115 'fa4compatibility' => 'ekit_offcanvas_menu_icon',
116 'default' => [
117 'value' => 'icon icon-burger-menu',
118 'library' => 'ekiticons',
119 ],
120 'condition' => [
121 'ekit_offcanvas_menu_type' => [ 'icon', 'icon_with_text' ],
122 ]
123 ]
124 );
125
126 $this->add_control(
127 'ekit_offcanvas_menu_icons_position',
128 [
129 'label' => esc_html__('Icon Positioin', 'elementskit-lite'),
130 'type' => Controls_Manager::SELECT,
131 'default' => 'before',
132 'options' => [
133 'before' => esc_html__('Before', 'elementskit-lite'),
134 'after' => esc_html__('After', 'elementskit-lite'),
135 ],
136 'selectors_dictionary' => [
137 'after' => 'display: flex; flex-direction: row-reverse;',
138 'before' => 'display: flex; flex-direction: row;',
139 ],
140 'selectors' => [
141 '{{WRAPPER}} .ekit-offcanvas-toggle-wraper a.ekit_offcanvas-sidebar' => '{{VALUE}}; width: fit-content;',
142 ],
143 'condition' => [
144 'ekit_offcanvas_menu_type' => 'icon_with_text',
145 ]
146 ]
147
148 );
149
150 $this->add_control(
151 'ekit_offcanvas_menu_text',
152 [
153 'label' => esc_html__('Text', 'elementskit-lite'),
154 'label_block' => true,
155 'type' => Controls_Manager::TEXT,
156 'dynamic' => [
157 'active' => true,
158 ],
159 'condition' => [
160 'ekit_offcanvas_menu_type' => [ 'text', 'icon_with_text' ],
161 ]
162 ]
163 );
164
165 $this->end_controls_tab();
166
167
168 // Close
169 $this->start_controls_tab(
170 'ekit_offcanvas_close_tab',
171 [
172 'label' => esc_html__( 'Closed', 'elementskit-lite' )
173 ]
174 );
175
176 $this->add_control(
177 'ekit_offcanvas_menu_close_type',
178 [
179 'label' => esc_html__('Close Menu Type:', 'elementskit-lite'),
180 'type' => Controls_Manager::SELECT,
181 'default' => 'icon',
182 'options' => [
183 'icon' => esc_html__('Icon', 'elementskit-lite'),
184 'text' => esc_html__('Text', 'elementskit-lite'),
185 'icon_with_text' => esc_html__('Icon with Text', 'elementskit-lite'),
186 ],
187 ]
188 );
189
190 $this->add_control(
191 'ekit_offcanvas_menu_close_icons',
192 [
193 'label' => esc_html__('Close Icon', 'elementskit-lite'),
194 'label_block' => true,
195 'type' => Controls_Manager::ICONS,
196 'fa4compatibility' => 'ekit_offcanvas_menu_close_icon',
197 'default' => [
198 'value' => 'fas fa-times',
199 'library' => 'fa-solid',
200 ],
201 'condition' => [
202 'ekit_offcanvas_menu_close_type' => [ 'icon', 'icon_with_text' ],
203 ]
204 ]
205 );
206
207 $this->add_control(
208 'ekit_offcanvas_menu_close_icons_position',
209 [
210 'label' => esc_html__('Icon Positioin', 'elementskit-lite'),
211 'type' => Controls_Manager::SELECT,
212 'default' => 'before',
213 'options' => [
214 'before' => esc_html__('Before', 'elementskit-lite'),
215 'after' => esc_html__('After', 'elementskit-lite'),
216 ],
217 'selectors_dictionary' => [
218 'after' => 'display: flex; flex-direction: row-reverse;',
219 'before' => 'display: flex; flex-direction: row;',
220 ],
221 'selectors' => [
222 '{{WRAPPER}} .ekit-sidebar-group a.ekit_close-side-widget' => '{{VALUE}};',
223 ],
224 'condition' => [
225 'ekit_offcanvas_menu_close_type' => 'icon_with_text',
226 ]
227 ]
228 );
229
230 $this->add_control(
231 'ekit_offcanvas_menu_close_text',
232 [
233 'label' => esc_html__('Text', 'elementskit-lite'),
234 'label_block' => true,
235 'type' => Controls_Manager::TEXT,
236 'default' => esc_html__( 'Close', 'elementskit-lite' ),
237 'dynamic' => [
238 'active' => true,
239 ],
240 'condition' => [
241 'ekit_offcanvas_menu_close_type' => [ 'text', 'icon_with_text' ],
242 ]
243 ]
244 );
245
246 $this->end_controls_tab();
247
248 $this->end_controls_tabs();
249 // end tabs
250
251 $this->add_control(
252 'ekit_offcanvas_icons_spacing',
253 [
254 'label' => esc_html__( 'Icons Gap', 'elementskit-lite' ),
255 'type' => Controls_Manager::SLIDER,
256 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
257 'separator' => 'before',
258 'render_type' => 'template',
259 'range' => [
260 'px' => [
261 'min' => 0,
262 'max' => 1000,
263 ],
264 '%' => [
265 'min' => 0,
266 'max' => 100,
267 ],
268 ],
269 'selectors' => [
270 '{{WRAPPER}} .ekit-wid-con .ekit-offcanvas-toggle-wraper.before .ekit_navSidebar-button :is(svg, i)' => 'margin-right:{{SIZE}}{{UNIT}};',
271 '{{WRAPPER}} .ekit-wid-con .ekit-offcanvas-toggle-wraper.after .ekit_navSidebar-button :is(svg, i)' => 'margin-left:{{SIZE}}{{UNIT}};',
272 '{{WRAPPER}} .ekit-wid-con .ekit-sidebar-widget .ekit_widget-heading.before :is(svg, i)' => 'margin-right:{{SIZE}}{{UNIT}};',
273 '{{WRAPPER}} .ekit-wid-con .ekit-sidebar-widget .ekit_widget-heading.after :is(svg, i)' => 'margin-left:{{SIZE}}{{UNIT}};',
274 ],
275 'conditions' => [
276 'relation' => 'or',
277 'terms' => [
278 [
279 'name' => 'ekit_offcanvas_menu_close_type',
280 'value' => 'icon_with_text',
281 ],
282 [
283 'name' => 'ekit_offcanvas_menu_type',
284 'value' => 'icon_with_text',
285 ],
286 ],
287 ],
288 ]
289 );
290
291 $this->add_control(
292 'ekit_offcanvas_disable_bodyscroll',
293 [
294 'label' => esc_html__( 'Disable Scroll', 'elementskit-lite' ),
295 'type' => Controls_Manager::SWITCHER,
296 'description' => esc_html__('To disable body scrolling when an offcanvas menu is open', 'elementskit-lite'),
297 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ),
298 'label_off' => esc_html__( 'No', 'elementskit-lite' ),
299 'return_value' => 'yes',
300 'default' => '',
301 ]
302 );
303
304 $this->end_controls_section();
305
306 $this->start_controls_section(
307 'ekit_header_search_setting',
308 [
309 'label' => esc_html__('Offcanvas Settings', 'elementskit-lite'),
310 ]
311 );
312
313 $this->add_control(
314 'ekit_header_search_style',
315 [
316 'label' => esc_html__( 'Offcanvas Style', 'elementskit-lite' ),
317 'type' => Controls_Manager::SELECT,
318 'default' => 'ekit-slide',
319 'options' => [
320 'ekit-slide' => esc_html__( 'Slide', 'elementskit-lite' ),
321 'ekit-fade' => esc_html__( 'Fade', 'elementskit-lite' ),
322 ],
323 ]
324 );
325
326 $this->add_control(
327 'ekit_header_search_transition',
328 [
329 'label' => esc_html__( 'Transition Duration (s)', 'elementskit-lite' ),
330 'type' => Controls_Manager::NUMBER,
331 'max' => 50,
332 'step' => 5,
333 'step' => 0.5,
334 'default' => 0.5,
335 'selectors' => [
336 '{{WRAPPER}} .ekit-sidebar-group' => '--transition-duration: {{SIZE}}s',
337 ],
338 ]
339 );
340
341 $this->end_controls_section();
342
343 $this->start_controls_section(
344 'ekit_header_offcanvas_section_tab_style',
345 [
346 'label' => esc_html__('Offcanvas', 'elementskit-lite'),
347 'tab' => Controls_Manager::TAB_STYLE,
348 ]
349 );
350
351 $this->start_controls_tabs('ekit_header_offcanvas_style_tabs');
352 $this->start_controls_tab(
353 'ekit_header_offcanvas_style_hamburger_tab',
354 [
355 'label' => esc_html__( 'Hamburger', 'elementskit-lite' )
356 ]
357 );
358
359 $this->add_responsive_control(
360 'ekit_offcanvas_icon_color',
361 [
362 'label' =>esc_html__( 'Color', 'elementskit-lite' ),
363 'type' => Controls_Manager::COLOR,
364 'default' => '#333',
365 'selectors' => [
366 '{{WRAPPER}} .ekit_navSidebar-button' => 'color: {{VALUE}};',
367 '{{WRAPPER}} .ekit_navSidebar-button svg' => 'fill: {{VALUE}};',
368 ],
369 ]
370 );
371
372 $this->add_responsive_control(
373 'ekit_offcanvas_icon_bg_color',
374 [
375 'label' =>esc_html__( 'Background Color', 'elementskit-lite' ),
376 'type' => Controls_Manager::COLOR,
377 'selectors' => [
378 '{{WRAPPER}} .ekit_navSidebar-button' => 'background-color: {{VALUE}};',
379 ],
380 ]
381 );
382
383 $this->add_control(
384 'ekit_offcanvas_icon_hover_title',
385 [
386 'label' => __( 'Hover', 'elementskit-lite' ),
387 'type' => Controls_Manager::HEADING,
388 'separator' => 'before',
389 ]
390 );
391
392 $this->add_responsive_control(
393 'ekit_offcanvas_icon_color_hover',
394 [
395 'label' =>esc_html__( 'Color', 'elementskit-lite' ),
396 'type' => Controls_Manager::COLOR,
397 'selectors' => [
398 '{{WRAPPER}} .ekit_navSidebar-button:hover' => 'color: {{VALUE}};',
399 '{{WRAPPER}} .ekit_navSidebar-button:hover svg' => 'fill: {{VALUE}};',
400 ],
401 ]
402 );
403
404 $this->add_responsive_control(
405 'ekit_offcanvas_icon_bg_color_hover',
406 [
407 'label' =>esc_html__( 'Background Color', 'elementskit-lite' ),
408 'type' => Controls_Manager::COLOR,
409 'selectors' => [
410 '{{WRAPPER}} .ekit_navSidebar-button:hover' => 'background-color: {{VALUE}};',
411 ],
412 ]
413 );
414
415 $this->add_responsive_control(
416 'ekit_offcanvas_icon_border_color_hover',
417 [
418 'label' => esc_html__( 'Border Color', 'elementskit-lite' ),
419 'type' => Controls_Manager::COLOR,
420 'selectors' => [
421 '{{WRAPPER}} .ekit_navSidebar-button:hover' => 'border-color: {{VALUE}};',
422 ],
423 ]
424 );
425
426 $this->add_control(
427 'ekit_offcanvas_text_font_hr',
428 [
429 'type' => Controls_Manager::DIVIDER,
430 ]
431 );
432
433 $this->add_responsive_control(
434 'ekit_offcanvas_icon_font_size',
435 [
436 'label' => esc_html__('Icon Size', 'elementskit-lite'),
437 'type' => Controls_Manager::SLIDER,
438 'size_units' => ['px', 'em'],
439 'default' => [
440 'unit' => 'px',
441 'size' => '20',
442 ],
443 'selectors' => [
444 '{{WRAPPER}} .ekit_navSidebar-button i' => 'font-size: {{SIZE}}{{UNIT}};',
445 '{{WRAPPER}} .ekit_navSidebar-button svg' => 'max-width: {{SIZE}}{{UNIT}};',
446 ],
447 'condition' => [
448 'ekit_offcanvas_menu_type!' => [ 'text' ],
449 ]
450 ]
451 );
452
453 $this->add_group_control(
454 Group_Control_Typography::get_type(),
455 [
456 'name' => 'ekit_offcanvas_text_typo',
457 'label' => esc_html__('Text Typography', 'elementskit-lite'),
458 'selector' => '{{WRAPPER}} .ekit_navSidebar-button',
459 'fields_options' => [
460 'typography' => [
461 'default' => 'custom',
462 ],
463 'font_weight' => [
464 'default' => '400',
465 ],
466 'font_size' => [
467 'label' => esc_html__('Font Size (px)', 'elementskit-lite'),
468 'responsive' => false,
469 'size_units' => ['px']
470 ],
471 ],
472 'condition' => [
473 'ekit_offcanvas_menu_type' => [ 'text', 'icon_with_text' ],
474 ]
475 ]
476 );
477
478 $this->add_group_control(
479 Group_Control_Border::get_type(),
480 [
481 'name' => 'ekit_border',
482 'selector' => '{{WRAPPER}} .ekit_navSidebar-button',
483 'separator' => 'before',
484 ]
485 );
486
487 $this->add_responsive_control(
488 'ekit_offcanvas_humburger_text_align',
489 [
490 'label' => __( 'Alignment', 'elementskit-lite' ),
491 'type' => Controls_Manager::CHOOSE,
492 'options' => [
493 'left' => [
494 'title' => __( 'Left', 'elementskit-lite' ),
495 'icon' => 'eicon-text-align-left',
496 ],
497 'center' => [
498 'title' => __( 'Center', 'elementskit-lite' ),
499 'icon' => 'eicon-text-align-center',
500 ],
501 'right' => [
502 'title' => __( 'Right', 'elementskit-lite' ),
503 'icon' => 'eicon-text-align-right',
504 ],
505 ],
506 'selectors' => [
507 '{{WRAPPER}} .ekit-offcanvas-toggle-wraper' => 'text-align: {{VALUE}}',
508 ],
509 'toggle' => true,
510 ]
511 );
512
513 // box shadow
514 $this->add_group_control(
515 Group_Control_Box_Shadow::get_type(), [
516 'name' => 'ekit_header_search',
517 'selector' => '{{WRAPPER}} .ekit_navSidebar-button',
518
519 ]
520 );
521 // border radius
522 $this->add_control(
523 'ekit_offcanvas_border_radius',
524 [
525 'label' => esc_html__( 'Border radius', 'elementskit-lite' ),
526 'type' => Controls_Manager::DIMENSIONS,
527 'size_units' => [ 'px', '%', 'em' ],
528 'default' => [
529 'top' => '',
530 'right' => '',
531 'bottom' => '' ,
532 'left' => '',
533 'unit' => '%',
534 ],
535 'selectors' => [
536 '{{WRAPPER}} .ekit_navSidebar-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
537 ],
538 ]
539 );
540
541 $this->add_responsive_control(
542 'ekit_offcanvas_padding',
543 [
544 'label' => esc_html__('Padding', 'elementskit-lite'),
545 'type' => Controls_Manager::DIMENSIONS,
546 'size_units' => ['px', 'em'],
547 'default' => [
548 'top' => '4',
549 'right' => '7',
550 'bottom' => '5' ,
551 'left' => '7',
552 ],
553 'selectors' => [
554 '{{WRAPPER}} .ekit_navSidebar-button, {{WRAPPER}} .ekit_social_media ul > li:last-child' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
555 ],
556 ]
557 );
558
559 $this->add_responsive_control(
560 'ekit_offcanvas_margin',
561 [
562 'label' => esc_html__('Margin', 'elementskit-lite'),
563 'type' => Controls_Manager::DIMENSIONS,
564 'size_units' => ['px', 'em'],
565 'default' => [
566 'top' => '',
567 'right' => '',
568 'bottom' => '' ,
569 'left' => '',
570 ],
571 'selectors' => [
572 '{{WRAPPER}} .ekit_navSidebar-button, {{WRAPPER}} .ekit_social_media ul > li:last-child' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
573 ],
574 ]
575 );
576
577 $this->end_controls_tab();
578
579 $this->start_controls_tab(
580 'ekit_header_offcanvas_style_close_tab',
581 [
582 'label' => esc_html__( 'Closed', 'elementskit-lite' )
583 ]
584 );
585
586 $this->add_responsive_control(
587 'ekit_offcanvas_close_icon_color',
588 [
589 'label' =>esc_html__( 'Color', 'elementskit-lite' ),
590 'type' => Controls_Manager::COLOR,
591 'default' => '#333',
592 'selectors' => [
593 '{{WRAPPER}} .ekit_close-side-widget' => 'color: {{VALUE}};',
594 '{{WRAPPER}} .ekit_close-side-widget svg' => 'fill:{{VALUE}};',
595 ],
596 ]
597 );
598
599 $this->add_responsive_control(
600 'ekit_offcanvas_close_icon_bg_color',
601 [
602 'label' =>esc_html__( 'Background Color', 'elementskit-lite' ),
603 'type' => Controls_Manager::COLOR,
604 'selectors' => [
605 '{{WRAPPER}} .ekit_close-side-widget' => 'background-color: {{VALUE}};',
606 ],
607 ]
608 );
609
610 $this->add_control(
611 'ekit_offcanvas_close_icon_hover_title',
612 [
613 'label' => __( 'Hover', 'elementskit-lite' ),
614 'type' => Controls_Manager::HEADING,
615 'separator' => 'before',
616 ]
617 );
618
619 $this->add_responsive_control(
620 'ekit_offcanvas_close_icon_color_hover',
621 [
622 'label' =>esc_html__( 'Color', 'elementskit-lite' ),
623 'type' => Controls_Manager::COLOR,
624 'selectors' => [
625 '{{WRAPPER}} .ekit_close-side-widget:hover' => 'color: {{VALUE}};',
626 '{{WRAPPER}} .ekit_close-side-widget:hover svg' => 'fill: {{VALUE}};'
627 ],
628 ]
629 );
630
631 $this->add_responsive_control(
632 'ekit_offcanvas_close_icon_bg_color_hover',
633 [
634 'label' =>esc_html__( 'Background Color', 'elementskit-lite' ),
635 'type' => Controls_Manager::COLOR,
636 'selectors' => [
637 '{{WRAPPER}} .ekit_close-side-widget:hover' => 'background-color: {{VALUE}};',
638 ],
639 ]
640 );
641
642 $this->add_responsive_control(
643 'ekit_offcanvas_close_icon_border_color_hover',
644 [
645 'label' =>esc_html__( 'Border Color', 'elementskit-lite' ),
646 'type' => Controls_Manager::COLOR,
647 'selectors' => [
648 '{{WRAPPER}} .ekit_close-side-widget:hover' => 'border-color: {{VALUE}};',
649 ],
650 ]
651 );
652
653 $this->add_responsive_control(
654 'ekit_offcanvas_close_icon_font_size',
655 [
656 'label' => esc_html__('Icon Size', 'elementskit-lite'),
657 'type' => Controls_Manager::SLIDER,
658 'size_units' => ['px', 'em'],
659 'separator' => 'before',
660 'default' => [
661 'unit' => 'px',
662 'size' => '20',
663 ],
664 'selectors' => [
665 '{{WRAPPER}} .ekit_close-side-widget i' => 'font-size: {{SIZE}}{{UNIT}};',
666 '{{WRAPPER}} .ekit_close-side-widget svg' => 'max-width: {{SIZE}}{{UNIT}};',
667 ],
668 ]
669 );
670
671 $this->add_group_control(
672 Group_Control_Typography::get_type(),
673 [
674 'name' => 'ekit_offcanvas_close_typography',
675 'selector' => '{{WRAPPER}} .ekit_close-side-widget',
676 ]
677 );
678
679 $this->add_responsive_control(
680 'close_btn_size',
681 [
682 'label' => esc_html__('Box Size (px)', 'elementskit-lite'),
683 'type' => Controls_Manager::SLIDER,
684 'selectors' => [
685 '{{WRAPPER}} .ekit_close-side-widget' => 'width: {{SIZE}}px; height: {{SIZE}}px; line-height: calc({{SIZE}}px - 4px);',
686 ]
687 ]
688 );
689
690 $this->add_group_control(
691 Group_Control_Border::get_type(),
692 [
693 'name' => 'ekit_close_border',
694 'selector' => '{{WRAPPER}} .ekit_close-side-widget',
695 'separator' => 'before',
696 ]
697 );
698
699 // box shadow
700 $this->add_group_control(
701 Group_Control_Box_Shadow::get_type(), [
702 'name' => 'ekit_header_search_close',
703 'selector' => '{{WRAPPER}} .ekit_close-side-widget',
704
705 ]
706 );
707 // border radius
708 $this->add_control(
709 'ekit_offcanvas_close_border_radius',
710 [
711 'label' => esc_html__( 'Border radius', 'elementskit-lite' ),
712 'type' => Controls_Manager::DIMENSIONS,
713 'size_units' => [ 'px', '%', 'em' ],
714 'default' => [
715 'top' => '50',
716 'right' => '50',
717 'bottom' => '50' ,
718 'left' => '50',
719 'unit' => '%',
720 ],
721 'selectors' => [
722 '{{WRAPPER}} .ekit_close-side-widget' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
723 ],
724 ]
725 );
726
727 $this->add_responsive_control(
728 'ekit_offcanvas_close_padding',
729 [
730 'label' => esc_html__('Padding', 'elementskit-lite'),
731 'type' => Controls_Manager::DIMENSIONS,
732 'size_units' => ['px', 'em'],
733 'default' => [
734 'top' => '4',
735 'right' => '7',
736 'bottom' => '5' ,
737 'left' => '7',
738 ],
739 'selectors' => [
740 '{{WRAPPER}} .ekit_close-side-widget' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
741 ],
742 ]
743 );
744
745 $this->add_responsive_control(
746 'ekit_offcanvas_close_margin',
747 [
748 'label' => esc_html__('Margin', 'elementskit-lite'),
749 'type' => Controls_Manager::DIMENSIONS,
750 'size_units' => ['px', 'em'],
751 'default' => [
752 'top' => '',
753 'right' => '',
754 'bottom' => '' ,
755 'left' => '',
756 ],
757 'selectors' => [
758 '{{WRAPPER}} .ekit_close-side-widget' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
759 ],
760 ]
761 );
762
763 $this->end_controls_tab();
764 $this->end_controls_tabs();
765
766
767
768 $this->end_controls_section();
769
770 $this->start_controls_section(
771 'ekit_offcanvas_panel_style_tab',
772 [
773 'label' => __( 'Offcanvas Panel', 'elementskit-lite' ),
774 'tab' => Controls_Manager::TAB_STYLE,
775 ]
776 );
777
778 $this->add_responsive_control(
779 'eit_offcanvas_width',
780 [
781 'label' => __( 'Width', 'elementskit-lite' ),
782 'type' => Controls_Manager::SLIDER,
783 'size_units' => [ 'px', '%' ],
784 'selectors' => [
785 '{{WRAPPER}} .ekit-wid-con .ekit-sidebar-widget' => 'max-width: {{SIZE}}{{UNIT}};',
786 ],
787 ]
788 );
789
790 $this->add_group_control(
791 Group_Control_Background::get_type(),
792 [
793 'name' => 'ekit_offcanvas_background',
794 'label' => __( 'Background', 'elementskit-lite' ),
795 'types' => [ 'classic', 'gradient' ],
796 'selector' => '{{WRAPPER}} .ekit-wid-con .ekit-sidebar-widget',
797 ]
798 );
799
800 // Position
801 $this->add_control(
802 'ekit_offcanvas_position',
803 [
804 'label' => esc_html__( 'Position', 'elementskit-lite' ),
805 'type' => Controls_Manager::CHOOSE,
806 'options' => [
807 'left' => [
808 'title' => esc_html__( 'Left', 'elementskit-lite' ),
809 'icon' => 'eicon-chevron-left',
810 ],
811 'right' => [
812 'title' => esc_html__( 'Right', 'elementskit-lite' ),
813 'icon' => 'eicon-chevron-right',
814 ],
815 ],
816 'default' => 'right',
817 'toggle' => false,
818 'prefix_class' => 'ekit-off-canvas-position-',
819 ]
820 );
821
822 // Padding
823 $this->add_control(
824 'ekit_offcanvas_panel_padding',
825 [
826 'label' => esc_html__('Padding', 'elementskit-lite'),
827 'type' => Controls_Manager::DIMENSIONS,
828 'size_units' => ['px', 'em'],
829 'default' => [
830 'top' => '',
831 'right' => '',
832 'bottom' => '' ,
833 'left' => '',
834 ],
835 'selectors' => [
836 '{{WRAPPER}} .ekit-wid-con .ekit_sidebar-textwidget' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
837 ],
838 ]
839 );
840
841 $this->end_controls_section();
842
843 $this->insert_pro_message();
844 }
845
846
847 protected function render( ) {
848 echo '<div class="ekit-wid-con" >';
849 $this->render_raw();
850 echo '</div>';
851 }
852
853 protected function render_raw( ) {
854 $settings = $this->get_settings();
855
856 $data_settings = [
857 'disable_bodyscroll' => $settings['ekit_offcanvas_disable_bodyscroll'],
858 ];
859
860 $menu_icons_position = isset($settings['ekit_offcanvas_menu_icons_position']) ? $settings['ekit_offcanvas_menu_icons_position'] : 'before';
861 $close_icons_position = isset($settings['ekit_offcanvas_menu_close_icons_position']) ? $settings['ekit_offcanvas_menu_close_icons_position'] : 'before';
862
863 // Accessibility helpers.
864 $offcanvas_sidebar_id = 'ekit-offcanvas-' . $this->get_id();
865 // Only add an aria-label when the control shows no visible text (icon-only),
866 // so we never override a visible label (WCAG 2.5.3 Label in Name).
867 $offcanvas_open_has_text = in_array( $settings['ekit_offcanvas_menu_type'], [ 'text', 'icon_with_text' ], true );
868 $offcanvas_close_has_text = in_array( $settings['ekit_offcanvas_menu_close_type'], [ 'text', 'icon_with_text' ], true );
869 ?>
870 <div class="ekit-offcanvas-toggle-wraper <?php echo esc_attr($menu_icons_position); ?>">
871 <a href="#" class="ekit_navSidebar-button ekit_offcanvas-sidebar" role="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="<?php echo esc_attr( $offcanvas_sidebar_id ); ?>"<?php echo $offcanvas_open_has_text ? '' : ' aria-label="' . esc_attr__( 'Open menu', 'elementskit-lite' ) . '"'; ?>>
872 <?php
873 if($settings['ekit_offcanvas_menu_type'] !== 'text') {
874 // new icon
875 $migrated = isset( $settings['__fa4_migrated']['ekit_offcanvas_menu_icons'] );
876 // Check if its a new widget without previously selected icon using the old Icon control
877 $is_new = empty( $settings['ekit_offcanvas_menu_icon'] );
878
879 if ( $is_new || $migrated ) {
880 // new icon
881 Icons_Manager::render_icon( $settings['ekit_offcanvas_menu_icons'], [ 'aria-hidden' => 'true' ] );
882 } else {
883 ?>
884 <i class="<?php echo esc_attr($settings['ekit_offcanvas_menu_icon']); ?>" aria-hidden="true"></i>
885 <?php
886 }
887 }
888 if($settings['ekit_offcanvas_menu_type'] == 'icon_with_text' || $settings['ekit_offcanvas_menu_type'] == 'text'){
889 echo esc_html($settings['ekit_offcanvas_menu_text']);
890 }
891 ?>
892 </a>
893 </div>
894 <!-- offset cart strart -->
895 <!-- sidebar cart item -->
896 <div id="<?php echo esc_attr( $offcanvas_sidebar_id ); ?>" class="ekit-sidebar-group info-group <?php echo esc_attr($settings['ekit_header_search_style']); ?>" data-settings="<?php echo esc_attr( wp_json_encode($data_settings)); ?>" role="dialog" aria-modal="true" aria-label="<?php echo esc_attr__( 'Menu', 'elementskit-lite' ); ?>">
897 <div class="ekit-overlay ekit-bg-black"></div>
898 <div class="ekit-sidebar-widget">
899 <div class="ekit_sidebar-widget-container">
900 <div class="ekit_widget-heading <?php echo esc_attr($close_icons_position); ?>">
901 <a href="#" class="ekit_close-side-widget" role="button"<?php echo $offcanvas_close_has_text ? '' : ' aria-label="' . esc_attr__( 'Close menu', 'elementskit-lite' ) . '"'; ?>>
902
903 <?php
904 // new icon
905 $migrated = isset($settings['__fa4_migrated']['ekit_offcanvas_menu_close_icons']);
906 // Check if its a new widget without previously selected icon using the old Icon control
907 $is_new = empty($settings['ekit_offcanvas_menu_close_icon']);
908
909 if($settings['ekit_offcanvas_menu_close_type'] !== 'text'){
910 if ($is_new || $migrated) {
911 Icons_Manager::render_icon($settings['ekit_offcanvas_menu_close_icons'], ['aria-hidden' => 'true']);
912 } else {
913 ?>
914 <i class="<?php echo esc_attr($settings['ekit_offcanvas_menu_close_icon']); ?>" aria-hidden="true"></i>
915 <?php
916 }
917 }
918
919 if($settings['ekit_offcanvas_menu_close_type'] == 'icon_with_text' || $settings['ekit_offcanvas_menu_close_type'] == 'text' ){
920 echo esc_html($settings['ekit_offcanvas_menu_close_text']);
921 }
922 ?>
923
924 </a>
925 </div>
926 <div class="ekit_sidebar-textwidget">
927 <?php echo Widget_Area_Utils::parse( $settings['ekit_offcanvas_content'], $this->get_id(), 99 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering ?>
928 </div>
929 </div>
930 </div>
931 </div> <!-- END sidebar widget item -->
932 <!-- END offset cart strart -->
933 <?php
934 }
935 }
936