PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.5.3
Easy Elements for Elementor – Addons & Website Templates v1.5.3
1.5.3 1.5.2 1.5.1 1.5.0 1.4.9 1.4.6 1.4.7 1.4.8 1.4.5 1.4.4 1.4.3 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 All 47 releases
easy-elements / widgets / faq / faq.php

faq.php in Easy Elements for Elementor – Addons & Website Templates 1.5.3, at widgets/faq/faq.php

899 lines 26.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Easyel\EasyElements\Widgets;
3 use Elementor\Controls_Manager;
4 use Elementor\Repeater;
5 use Elementor\Icons_Manager;
6 use Elementor\Group_Control_Background;
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12 class Easyel_FAQ_Accordion_Widget extends \Elementor\Widget_Base {
13
14 public function get_name() {
15 return 'eel-faq-accordion';
16 }
17
18 public function get_title() {
19 return esc_html__( 'FAQ', 'easy-elements' );
20 }
21
22 public function get_icon() {
23 return 'easyicon easyelIcon-faq-1';
24 }
25
26 public function get_categories() {
27 return [ 'easyelements_category' ];
28 }
29
30 public function get_keywords() {
31 return [ 'faq', 'accordion', 'question', 'answer', 'text' ];
32 }
33
34 public function get_style_depends() {
35 return [
36 'eel-faq-accordion',
37 ];
38 }
39
40 public function get_script_depends() {
41 return [
42 'eel-faq-accordion',
43 ];
44 }
45
46
47 protected function register_controls() {
48 $this->start_controls_section(
49 'section_faq_content',
50 [ 'label' => esc_html__( 'FAQ Items', 'easy-elements' ) ]
51 );
52
53 $repeater = new Repeater();
54
55 $repeater->add_control( 'title', [
56 'label' => esc_html__( 'Question', 'easy-elements' ),
57 'type' => Controls_Manager::TEXT,
58 'label_block' => true,
59 'default' => esc_html__( 'What is Easy Elements?', 'easy-elements' ),
60 ] );
61
62 $repeater->add_control( 'description', [
63 'label' => esc_html__( 'Answer', 'easy-elements' ),
64 'type' => Controls_Manager::TEXTAREA,
65 'default' => esc_html__( 'Easy Elements is a best plugin for Elementor.', 'easy-elements' ),
66 ] );
67
68 $repeater->add_control( 'active_toggle', [
69 'label' => esc_html__( 'Active by Default', 'easy-elements' ),
70 'type' => Controls_Manager::SWITCHER,
71 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
72 'label_off' => esc_html__( 'No', 'easy-elements' ),
73 'return_value' => 'yes',
74 'default' => 'no',
75 ] );
76
77 $this->add_control( 'faq_items', [
78 'label' => esc_html__( 'FAQ List', 'easy-elements' ),
79 'type' => Controls_Manager::REPEATER,
80 'fields' => $repeater->get_controls(),
81 'default' => [
82 [
83 'title' => esc_html__( 'What is Easy Elements?', 'easy-elements' ),
84 'description' => esc_html__( 'Easy Elements is a custom Elementor addon plugin that offers useful widgets.', 'easy-elements' ),
85 ],
86 [
87 'title' => esc_html__( 'Does it work with Elementor Free?', 'easy-elements' ),
88 'description' => esc_html__( 'Yes, it fully supports Elementor Free version without requiring Elementor Pro.', 'easy-elements' ),
89 ],
90 [
91 'title' => esc_html__( 'How to install Easy Elements?', 'easy-elements' ),
92 'description' => esc_html__( 'Upload the plugin via WordPress Dashboard or FTP and activate it.', 'easy-elements' ),
93 ],
94 [
95 'title' => esc_html__( 'What widgets are included?', 'easy-elements' ),
96 'description' => esc_html__( 'Widgets include logo grid, testimonials, CTA sections, pricing tables, and more.', 'easy-elements' ),
97 ],
98 [
99 'title' => esc_html__( 'How do I get support or updates?', 'easy-elements' ),
100 'description' => esc_html__( 'Support and updates are available via the official website or marketplace.', 'easy-elements' ),
101 ],
102 ],
103 'title_field' => '{{{ title }}}',
104 ] );
105
106 $this->add_control( 'title_tag', [
107 'label' => esc_html__( 'Title HTML Tag', 'easy-elements' ),
108 'type' => Controls_Manager::SELECT,
109 'default' => 'h4',
110 'options' => [
111 'h1' => 'H1',
112 'h2' => 'H2',
113 'h3' => 'H3',
114 'h4' => 'H4',
115 'h5' => 'H5',
116 'h6' => 'H6',
117 'div' => 'div',
118 'span' => 'span',
119 'p' => 'p',
120 ],
121 ] );
122
123 $this->add_control( 'icon_open', [
124 'label' => esc_html__( 'Open Icon', 'easy-elements' ),
125 'type' => Controls_Manager::ICONS,
126 'default' => [ '' ],
127 ] );
128
129 $this->add_control( 'icon_close', [
130 'label' => esc_html__( 'Close Icon', 'easy-elements' ),
131 'type' => Controls_Manager::ICONS,
132 'default' => [ '' ],
133 ] );
134
135 $this->add_control(
136 'icon_position',
137 [
138 'label' => esc_html__( 'Position', 'easy-elements' ),
139 'type' => \Elementor\Controls_Manager::CHOOSE,
140 'options' => [
141 'row-reverse' => [
142 'title' => esc_html__( 'Left', 'easy-elements' ),
143 'icon' => 'eicon-h-align-left',
144 ],
145 'row' => [
146 'title' => esc_html__( 'Right', 'easy-elements' ),
147 'icon' => 'eicon-h-align-right',
148 ],
149 ],
150 'default' => 'row',
151 'toggle' => true,
152 'selectors' => [
153 '{{WRAPPER}} .eel-faq-question' => 'flex-direction: {{VALUE}}; justify-content: left;',
154 ],
155 ]
156 );
157
158 $this->add_control( 'open_all_toggle', [
159 'label' => esc_html__( 'Open All FAQs by Default', 'easy-elements' ),
160 'type' => Controls_Manager::SWITCHER,
161 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
162 'label_off' => esc_html__( 'No', 'easy-elements' ),
163 'return_value' => 'yes',
164 'default' => 'no',
165 ] );
166
167 $this->add_control( 'enable_sticky', [
168 'label' => esc_html__( 'Enable Sticky', 'easy-elements' ),
169 'type' => Controls_Manager::SWITCHER,
170 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
171 'label_off' => esc_html__( 'No', 'easy-elements' ),
172 'return_value' => 'yes',
173 'default' => 'no',
174 'condition' => [
175 'open_all_toggle' => 'yes',
176 ],
177 ] );
178
179 $this->end_controls_section();
180
181 $this->start_controls_section(
182 'item_box_style_section',
183 [
184 'label' => esc_html__( 'Items', 'easy-elements' ),
185 'tab' => Controls_Manager::TAB_STYLE,
186 ]
187 );
188
189 $this->start_controls_tabs( 'item_style_tabs' );
190
191 $this->start_controls_tab(
192 'item_style_normal',
193 [
194 'label' => esc_html__( 'Normal', 'easy-elements' ),
195 ]
196 );
197
198 $this->add_group_control(
199 Group_Control_Background::get_type(),
200 [
201 'name' => 'faq_background',
202 'label' => esc_html__( 'Background Type', 'easy-elements' ),
203 'types' => [ 'classic', 'gradient' ],
204 'selector' => '{{WRAPPER}} .eel-faq-item',
205 ]
206 );
207
208 // Border Radius
209 $this->add_responsive_control( 'item_border_radius', [
210 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
211 'type' => Controls_Manager::DIMENSIONS,
212 'size_units' => [ 'px', '%', 'em' ],
213 'selectors' => [
214 '{{WRAPPER}} .eel-faq-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
215 ],
216 ] );
217
218 // Border
219 $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [
220 'name' => 'item_border',
221 'label' => esc_html__( 'Border', 'easy-elements' ),
222 'selector' => '{{WRAPPER}} .eel-faq-item',
223 ] );
224
225 $this->add_responsive_control(
226 'item_padding',
227 [
228 'label' => esc_html__('Padding', 'easy-elements'),
229 'type' => Controls_Manager::DIMENSIONS,
230 'size_units' => ['px'],
231 'selectors' => [
232 '{{WRAPPER}} .eel-faq-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
233 ],
234 ]
235 );
236
237 // Shadow
238 $this->add_group_control( \Elementor\Group_Control_Box_Shadow::get_type(), [
239 'name' => 'item_shadow',
240 'label' => esc_html__( 'Box Shadow', 'easy-elements' ),
241 'selector' => '{{WRAPPER}} .eel-faq-item',
242 ] );
243
244 $this->add_responsive_control(
245 'item_margin',
246 [
247 'label' => esc_html__('Items Space', 'easy-elements'),
248 'type' => Controls_Manager::SLIDER,
249 'size_units' => ['px'],
250 'selectors' => [
251 '{{WRAPPER}} .eel-faq-accordion' => 'gap: {{SIZE}}{{UNIT}};',
252 ],
253 ]
254 );
255 $this->end_controls_tab();
256
257 $this->start_controls_tab(
258 'item_style_hover',
259 [
260 'label' => esc_html__( 'Hover', 'easy-elements' ),
261 ]
262 );
263 $this->add_group_control(
264 \Elementor\Group_Control_Background::get_type(),
265 [
266 'name' => 'item_bg_hover',
267 'types' => [ 'classic', 'gradient' ],
268 'selector' => '{{WRAPPER}} .eel-faq-item:hover',
269 ]
270 );
271
272 $this->add_group_control(
273 \Elementor\Group_Control_Border::get_type(),
274 [
275 'name' => 'item_border_hover',
276 'selector' => '{{WRAPPER}} .eel-faq-item:hover',
277 ]
278 );
279
280 $this->add_group_control(
281 \Elementor\Group_Control_Box_Shadow::get_type(),
282 [
283 'name' => 'item_shadow_hover',
284 'selector' => '{{WRAPPER}} .eel-faq-item:hover',
285 ]
286 );
287 $this->end_controls_tab();
288
289 $this->start_controls_tab(
290 'item_style_active',
291 [
292 'label' => esc_html__( 'Active', 'easy-elements' ),
293 ]
294 );
295 $this->add_group_control(
296 \Elementor\Group_Control_Background::get_type(),
297 [
298 'name' => 'item_bg_active',
299 'types' => [ 'classic', 'gradient' ],
300 'selector' => '{{WRAPPER}} .eel-faq-item.active',
301 ]
302 );
303
304 $this->add_group_control(
305 \Elementor\Group_Control_Border::get_type(),
306 [
307 'name' => 'item_border_active',
308 'selector' => '{{WRAPPER}} .eel-faq-item.active',
309 ]
310 );
311
312 $this->add_group_control(
313 \Elementor\Group_Control_Box_Shadow::get_type(),
314 [
315 'name' => 'item_shadow_active',
316 'selector' => '{{WRAPPER}} .eel-faq-item.active',
317 ]
318 );
319
320 $this->end_controls_tab();
321 $this->end_controls_tabs();
322
323 $this->end_controls_section();
324
325 $this->start_controls_section(
326 'title_style_section',
327 [
328 'label' => esc_html__( 'Title', 'easy-elements' ),
329 'tab' => Controls_Manager::TAB_STYLE,
330 ]
331 );
332
333 $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [
334 'name' => 'title_typography',
335 'label' => esc_html__( 'Typography', 'easy-elements' ),
336 'selector' => '{{WRAPPER}} .eel-faq-title',
337 ] );
338
339 $this->start_controls_tabs( 'title_style_tabs' );
340
341 $this->start_controls_tab(
342 'title_style_normal',
343 [
344 'label' => esc_html__( 'Normal', 'easy-elements' ),
345 ]
346 );
347
348 $this->add_control( 'title_color', [
349 'label' => esc_html__( 'Color', 'easy-elements' ),
350 'type' => Controls_Manager::COLOR,
351 'selectors' => [
352 '{{WRAPPER}} .eel-faq-title' => 'color: {{VALUE}};',
353 ],
354 ] );
355
356 $this->add_control( 'title_bg_color', [
357 'label' => esc_html__( 'Background Color', 'easy-elements' ),
358 'type' => Controls_Manager::COLOR,
359 'selectors' => [
360 '{{WRAPPER}} .eel-faq-question' => 'background-color: {{VALUE}};',
361 ],
362 ] );
363
364 $this->add_group_control(
365 \Elementor\Group_Control_Border::get_type(),
366 [
367 'name' => 'title_border',
368 'selector' => '{{WRAPPER}} .eel-faq-question',
369 ]
370 );
371
372 $this->add_group_control(
373 \Elementor\Group_Control_Box_Shadow::get_type(),
374 [
375 'name' => 'title_shadow',
376 'selector' => '{{WRAPPER}} .eel-faq-question',
377 ]
378 );
379
380 $this->end_controls_tab();
381
382 $this->start_controls_tab(
383 'title_style_hover',
384 [
385 'label' => esc_html__( 'Hover', 'easy-elements' ),
386 ]
387 );
388
389 $this->add_control( 'title_color_hover', [
390 'label' => esc_html__( 'Color', 'easy-elements' ),
391 'type' => Controls_Manager::COLOR,
392 'selectors' => [
393 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-title' => 'color: {{VALUE}};',
394 ],
395 ] );
396
397 $this->add_control( 'title_bg_color_hover', [
398 'label' => esc_html__( 'Background Color', 'easy-elements' ),
399 'type' => Controls_Manager::COLOR,
400 'selectors' => [
401 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-question' => 'background-color: {{VALUE}};',
402 ],
403 ] );
404
405 $this->add_control( 'title_border_color_hover', [
406 'label' => esc_html__( 'Border Color', 'easy-elements' ),
407 'type' => Controls_Manager::COLOR,
408 'selectors' => [
409 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-question' => 'border-color: {{VALUE}};',
410 ],
411 ] );
412
413 $this->add_group_control(
414 \Elementor\Group_Control_Box_Shadow::get_type(),
415 [
416 'name' => 'title_shadow_hover',
417 'selector' => '{{WRAPPER}} .eel-faq-item:hover .eel-faq-question',
418 ]
419 );
420
421 $this->end_controls_tab();
422
423 $this->start_controls_tab(
424 'title_style_active',
425 [
426 'label' => esc_html__( 'Active', 'easy-elements' ),
427 ]
428 );
429
430 $this->add_control( 'title_color_active', [
431 'label' => esc_html__( 'Color', 'easy-elements' ),
432 'type' => Controls_Manager::COLOR,
433 'selectors' => [
434 '{{WRAPPER}} .eel-faq-item.active .eel-faq-title' => 'color: {{VALUE}};',
435 ],
436 ] );
437
438 $this->add_control( 'title_bg_color_active', [
439 'label' => esc_html__( 'Background Color', 'easy-elements' ),
440 'type' => Controls_Manager::COLOR,
441 'selectors' => [
442 '{{WRAPPER}} .eel-faq-item.active .eel-faq-question' => 'background-color: {{VALUE}};',
443 ],
444 ] );
445
446 $this->add_control( 'title_border_color_active', [
447 'label' => esc_html__( 'Border Color', 'easy-elements' ),
448 'type' => Controls_Manager::COLOR,
449 'selectors' => [
450 '{{WRAPPER}} .eel-faq-item.active .eel-faq-question' => 'border-color: {{VALUE}};',
451 ],
452 ] );
453
454 $this->add_group_control(
455 \Elementor\Group_Control_Box_Shadow::get_type(),
456 [
457 'name' => 'title_shadow_active',
458 'selector' => '{{WRAPPER}} .eel-faq-item.active .eel-faq-question',
459 ]
460 );
461
462 $this->end_controls_tab();
463 $this->end_controls_tabs();
464
465 $this->add_control(
466 'title_style_divider',
467 [
468 'type' => Controls_Manager::DIVIDER,
469 ]
470 );
471
472 $this->add_responsive_control( 'title_border_radius', [
473 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
474 'type' => Controls_Manager::DIMENSIONS,
475 'size_units' => [ 'px', '%' ],
476 'selectors' => [
477 '{{WRAPPER}} .eel-faq-question' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
478 ],
479 ] );
480
481 $this->add_responsive_control( 'title_padding', [
482 'label' => esc_html__( 'Padding', 'easy-elements' ),
483 'type' => Controls_Manager::DIMENSIONS,
484 'size_units' => [ 'px', 'em', '%' ],
485 'selectors' => [
486 '{{WRAPPER}} .eel-faq-question' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
487 ],
488 ] );
489
490 $this->end_controls_section();
491
492 // ===== Description Style =====
493 $this->start_controls_section(
494 'description_style_section',
495 [
496 'label' => esc_html__( 'Description', 'easy-elements' ),
497 'tab' => Controls_Manager::TAB_STYLE,
498 ]
499 );
500
501 $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [
502 'name' => 'description_typography',
503 'label' => esc_html__( 'Typography', 'easy-elements' ),
504 'selector' => '{{WRAPPER}} .eel-faq-answer',
505 ] );
506
507 $this->start_controls_tabs( 'description_style_tabs' );
508
509 $this->start_controls_tab(
510 'description_style_normal',
511 [
512 'label' => esc_html__( 'Normal', 'easy-elements' ),
513 ]
514 );
515
516 $this->add_control( 'description_color', [
517 'label' => esc_html__( 'Color', 'easy-elements' ),
518 'type' => Controls_Manager::COLOR,
519 'selectors' => [
520 '{{WRAPPER}} .eel-faq-answer' => 'color: {{VALUE}};',
521 ],
522 ] );
523
524 $this->add_control( 'description_bg_color', [
525 'label' => esc_html__( 'Background Color', 'easy-elements' ),
526 'type' => Controls_Manager::COLOR,
527 'selectors' => [
528 '{{WRAPPER}} .eel-faq-answer' => 'background-color: {{VALUE}};',
529 ],
530 ] );
531
532 $this->add_group_control(
533 \Elementor\Group_Control_Border::get_type(),
534 [
535 'name' => 'description_border',
536 'selector' => '{{WRAPPER}} .eel-faq-answer',
537 ]
538 );
539
540 $this->end_controls_tab();
541
542 $this->start_controls_tab(
543 'description_style_hover',
544 [
545 'label' => esc_html__( 'Hover', 'easy-elements' ),
546 ]
547 );
548
549 $this->add_control( 'description_color_hover', [
550 'label' => esc_html__( 'Color', 'easy-elements' ),
551 'type' => Controls_Manager::COLOR,
552 'selectors' => [
553 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-answer' => 'color: {{VALUE}};',
554 ],
555 ] );
556
557 $this->add_control( 'description_bg_color_hover', [
558 'label' => esc_html__( 'Background Color', 'easy-elements' ),
559 'type' => Controls_Manager::COLOR,
560 'selectors' => [
561 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-answer' => 'background-color: {{VALUE}};',
562 ],
563 ] );
564
565 $this->add_control( 'description_border_color_hover', [
566 'label' => esc_html__( 'Border Color', 'easy-elements' ),
567 'type' => Controls_Manager::COLOR,
568 'selectors' => [
569 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-answer' => 'border-color: {{VALUE}};',
570 ],
571 ] );
572
573 $this->end_controls_tab();
574
575 $this->start_controls_tab(
576 'description_style_active',
577 [
578 'label' => esc_html__( 'Active', 'easy-elements' ),
579 ]
580 );
581
582 $this->add_control( 'description_color_active', [
583 'label' => esc_html__( 'Color', 'easy-elements' ),
584 'type' => Controls_Manager::COLOR,
585 'selectors' => [
586 '{{WRAPPER}} .eel-faq-item.active .eel-faq-answer' => 'color: {{VALUE}};',
587 ],
588 ] );
589
590 $this->add_control( 'description_bg_color_active', [
591 'label' => esc_html__( 'Background Color', 'easy-elements' ),
592 'type' => Controls_Manager::COLOR,
593 'selectors' => [
594 '{{WRAPPER}} .eel-faq-item.active .eel-faq-answer' => 'background-color: {{VALUE}};',
595 ],
596 ] );
597
598 $this->add_control( 'description_border_color_active', [
599 'label' => esc_html__( 'Border Color', 'easy-elements' ),
600 'type' => Controls_Manager::COLOR,
601 'selectors' => [
602 '{{WRAPPER}} .eel-faq-item.active .eel-faq-answer' => 'border-color: {{VALUE}};',
603 ],
604 ] );
605
606 $this->end_controls_tab();
607 $this->end_controls_tabs();
608
609 $this->add_control(
610 'description_style_divider',
611 [
612 'type' => Controls_Manager::DIVIDER,
613 ]
614 );
615
616 $this->add_responsive_control( 'description_border_radius', [
617 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
618 'type' => Controls_Manager::DIMENSIONS,
619 'size_units' => [ 'px', '%' ],
620 'selectors' => [
621 '{{WRAPPER}} .eel-faq-answer' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
622 ],
623 ] );
624
625 $this->add_responsive_control( 'description_padding', [
626 'label' => esc_html__( 'Padding', 'easy-elements' ),
627 'type' => Controls_Manager::DIMENSIONS,
628 'size_units' => [ 'px', 'em', '%' ],
629 'selectors' => [
630 '{{WRAPPER}} .eel-faq-answer' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
631 ],
632 ] );
633
634 $this->end_controls_section();
635
636 $this->start_controls_section(
637 'icon_style_section',
638 [
639 'label' => esc_html__( 'Accordion Icon', 'easy-elements' ),
640 'tab' => Controls_Manager::TAB_STYLE,
641 ]
642 );
643
644 $this->start_controls_tabs( 'icon_style_tabs' );
645
646 $this->start_controls_tab(
647 'icon_style_normal',
648 [
649 'label' => esc_html__( 'Normal', 'easy-elements' ),
650 ]
651 );
652
653 $this->add_control( 'icon_color', [
654 'label' => esc_html__( 'Color', 'easy-elements' ),
655 'type' => Controls_Manager::COLOR,
656 'selectors' => [
657 '{{WRAPPER}} .eel-faq-icon, {{WRAPPER}} .eel-faq-icon svg' => 'color: {{VALUE}}; fill: {{VALUE}};',
658 ],
659 ] );
660
661 $this->add_control(
662 'icon_bg_color',
663 [
664 'label' => esc_html__( 'Background', 'easy-elements' ),
665 'type' => Controls_Manager::COLOR,
666 'selectors' => [
667 '{{WRAPPER}} .eel-faq-icon' => 'background: {{VALUE}};',
668 ],
669 ]
670 );
671
672 $this->add_responsive_control(
673 'icon_size',
674 [
675 'label' => esc_html__( 'Size', 'easy-elements' ),
676 'type' => \Elementor\Controls_Manager::SLIDER,
677 'size_units' => [ 'px', '%' ],
678 'selectors' => [
679 '{{WRAPPER}} .eel-faq-icon' => 'font-size: {{SIZE}}{{UNIT}};',
680 ],
681 ]
682 );
683
684 $this->add_responsive_control(
685 'icon_box_size',
686 [
687 'label' => esc_html__( 'Box Size', 'easy-elements' ),
688 'type' => \Elementor\Controls_Manager::SLIDER,
689 'size_units' => [ 'px', '%' ],
690 'selectors' => [
691 '{{WRAPPER}} .eel-faq-icon' => implode(
692 '',
693 [
694 'min-width: {{SIZE}}{{UNIT}};',
695 'min-height: {{SIZE}}{{UNIT}};',
696 'width: {{SIZE}}{{UNIT}};',
697 'height: {{SIZE}}{{UNIT}};',
698 'line-height: {{SIZE}}{{UNIT}};',
699 ]
700 ),
701 ]
702 ]
703 );
704
705 $this->add_responsive_control(
706 'icon_position_y',
707 [
708 'label' => esc_html__( 'Vertical Position', 'easy-elements' ),
709 'type' => \Elementor\Controls_Manager::SLIDER,
710 'size_units' => [ 'px', '%' ],
711 'range' => [
712 'px' => [
713 'min' => -100,
714 'max' => 100,
715 'step' => 1,
716 ],
717 '%' => [
718 'min' => -100,
719 'max' => 100,
720 ],
721 ],
722 'default' => [
723 'unit' => 'px',
724 'size' => 0,
725 ],
726 'selectors' => [
727 '{{WRAPPER}} .eel-faq-icon' => 'transform: translateY({{SIZE}}{{UNIT}});',
728 ],
729 ]
730 );
731
732 $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [
733 'name' => 'icon_border',
734 'label' => esc_html__( 'Border', 'easy-elements' ),
735 'selector' => '{{WRAPPER}} .eel-faq-icon',
736 ] );
737
738 $this->add_responsive_control(
739 'icon_border_radius',
740 [
741 'label' => esc_html__('Border Radius', 'easy-elements'),
742 'type' => Controls_Manager::DIMENSIONS,
743 'size_units' => ['px'],
744 'selectors' => [
745 '{{WRAPPER}} .eel-faq-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
746 ],
747 ]
748 );
749 $this->end_controls_tab();
750
751 $this->start_controls_tab(
752 'icon_style_hover',
753 [
754 'label' => esc_html__( 'Hover', 'easy-elements' ),
755 ]
756 );
757 $this->add_control( 'icon_color_hover', [
758 'label' => esc_html__( 'Color', 'easy-elements' ),
759 'type' => Controls_Manager::COLOR,
760 'selectors' => [
761 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-icon, {{WRAPPER}} .eel-faq-item:hover .eel-faq-icon svg path' => 'color: {{VALUE}}; fill: {{VALUE}};',
762 ],
763 ] );
764
765 $this->add_control(
766 'icon_hover_bg_color',
767 [
768 'label' => esc_html__( 'Background', 'easy-elements' ),
769 'type' => Controls_Manager::COLOR,
770 'selectors' => [
771 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-icon' => 'background: {{VALUE}};',
772 ],
773 ]
774 );
775
776 $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [
777 'name' => 'icon_hover_border',
778 'label' => esc_html__( 'Border', 'easy-elements' ),
779 'selector' => '{{WRAPPER}} .eel-faq-item:hover .eel-faq-icon',
780 ] );
781 $this->end_controls_tab();
782
783 $this->start_controls_tab(
784 'icon_style_active',
785 [
786 'label' => esc_html__( 'Active', 'easy-elements' ),
787 ]
788 );
789
790 $this->add_control( 'icon_color_active', [
791 'label' => esc_html__( 'Color', 'easy-elements' ),
792 'type' => Controls_Manager::COLOR,
793 'selectors' => [
794 '{{WRAPPER}} .eel-faq-item.active .eel-faq-icon, {{WRAPPER}} .eel-faq-item.active .eel-faq-icon svg path' => 'color: {{VALUE}}; fill: {{VALUE}};',
795 ],
796 ] );
797
798 $this->add_control(
799 'icon_active_bg_color',
800 [
801 'label' => esc_html__( 'Background', 'easy-elements' ),
802 'type' => Controls_Manager::COLOR,
803 'selectors' => [
804 '{{WRAPPER}} .eel-faq-item.active .eel-faq-icon' => 'background: {{VALUE}};',
805 ],
806 ]
807 );
808
809 $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [
810 'name' => 'icon_active_border',
811 'label' => esc_html__( 'Border', 'easy-elements' ),
812 'selector' => '{{WRAPPER}} .eel-faq-item.active .eel-faq-icon',
813 ] );
814
815 $this->add_responsive_control(
816 'icon_position_y_active',
817 [
818 'label' => esc_html__( 'Vertical Position', 'easy-elements' ),
819 'type' => \Elementor\Controls_Manager::SLIDER,
820 'size_units' => [ 'px', '%' ],
821 'range' => [
822 'px' => [
823 'min' => -100,
824 'max' => 100,
825 'step' => 1,
826 ],
827 '%' => [
828 'min' => -100,
829 'max' => 100,
830 ],
831 ],
832 'default' => [
833 'unit' => 'px',
834 'size' => 0,
835 ],
836 'selectors' => [
837 '{{WRAPPER}} .eel-faq-item.active .eel-faq-icon' => 'transform: translateY({{SIZE}}{{UNIT}});',
838 ],
839 ]
840 );
841
842 $this->end_controls_tab();
843 $this->end_controls_tabs();
844 $this->end_controls_section();
845 }
846
847
848 protected function render() {
849 $settings = $this->get_settings_for_display();
850 if ( empty( $settings['faq_items'] ) ) return;
851
852 $title_tag = tag_escape( $settings['title_tag'] ?? 'h4' );
853 $open_all_class = ( $settings['open_all_toggle'] === 'yes' ) ? 'eel-faq-open-all' : '';
854 $enable_sticky = ( $settings['enable_sticky'] === 'yes' ) ? 'eel-faq-sticky' : '';
855
856
857 ?>
858
859 <div class="eel-faq-accordion <?php echo esc_attr( $open_all_class ); ?> <?php echo esc_attr( $enable_sticky ); ?>" id="<?php echo esc_attr( $this->get_id() ); ?>">
860 <?php foreach ( $settings['faq_items'] as $index => $item ) :
861 $is_active = ( ! empty( $item['active_toggle'] ) && $item['active_toggle'] === 'yes' ) ? 'active' : '';
862 $title = isset( $item['title'] ) ? $item['title'] : '';
863 $description = isset( $item['description'] ) ? $item['description'] : '';
864 $icon_open = isset( $settings['icon_open'] ) ? $settings['icon_open'] : array();
865 $icon_close = isset( $settings['icon_close'] ) ? $settings['icon_close'] : array();
866 ?>
867 <div class="eel-faq-item <?php echo esc_attr( $is_active ); ?>">
868 <div class="eel-faq-question">
869 <<?php echo esc_html( $title_tag ); ?> class="eel-faq-title" tabindex="0">
870 <?php echo esc_html( $title ); ?>
871 </<?php echo esc_html( $title_tag ); ?>>
872 <span class="eel-faq-icon eel-faq-icon-open">
873 <?php
874 if ( ! empty( $icon_open ) && ! empty( $icon_open['value'] ) ) {
875 Icons_Manager::render_icon( $icon_open, [ 'aria-hidden' => 'true' ] );
876 } else {
877 echo '<i class="unicon-close" aria-hidden="true"></i>';
878 }
879 ?>
880 </span>
881 <span class="eel-faq-icon eel-faq-icon-close">
882 <?php
883 if ( ! empty( $icon_close ) && ! empty( $icon_close['value'] ) ) {
884 Icons_Manager::render_icon( $icon_close, [ 'aria-hidden' => 'true' ] );
885 } else {
886 echo '<i class="unicon-add" aria-hidden="true"></i>';
887 }
888 ?>
889 </span>
890 </div>
891 <div class="eel-faq-answer">
892 <?php echo wp_kses_post( $description ); ?>
893 </div>
894 </div>
895 <?php endforeach; ?>
896 </div>
897 <?php
898 }
899 }