PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.5.0
Easy Elements for Elementor – Addons & Website Templates v1.5.0
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.0, at widgets/faq/faq.php

908 lines 26.6 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__( 'Accordion', '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->add_control( 'enable_faq_schema', [
180 'label' => esc_html__( 'Enable FAQ Schema', 'easy-elements' ),
181 'type' => Controls_Manager::SWITCHER,
182 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
183 'label_off' => esc_html__( 'No', 'easy-elements' ),
184 'return_value' => 'yes',
185 'default' => 'no',
186 ] );
187
188 $this->end_controls_section();
189
190 $this->start_controls_section(
191 'item_box_style_section',
192 [
193 'label' => esc_html__( 'Items', 'easy-elements' ),
194 'tab' => Controls_Manager::TAB_STYLE,
195 ]
196 );
197
198 $this->start_controls_tabs( 'item_style_tabs' );
199
200 $this->start_controls_tab(
201 'item_style_normal',
202 [
203 'label' => esc_html__( 'Normal', 'easy-elements' ),
204 ]
205 );
206
207 $this->add_group_control(
208 Group_Control_Background::get_type(),
209 [
210 'name' => 'faq_background',
211 'label' => esc_html__( 'Background Type', 'easy-elements' ),
212 'types' => [ 'classic', 'gradient' ],
213 'selector' => '{{WRAPPER}} .eel-faq-item',
214 ]
215 );
216
217 // Border Radius
218 $this->add_responsive_control( 'item_border_radius', [
219 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
220 'type' => Controls_Manager::DIMENSIONS,
221 'size_units' => [ 'px', '%', 'em' ],
222 'selectors' => [
223 '{{WRAPPER}} .eel-faq-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
224 ],
225 ] );
226
227 // Border
228 $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [
229 'name' => 'item_border',
230 'label' => esc_html__( 'Border', 'easy-elements' ),
231 'selector' => '{{WRAPPER}} .eel-faq-item',
232 ] );
233
234 $this->add_responsive_control(
235 'item_padding',
236 [
237 'label' => esc_html__('Padding', 'easy-elements'),
238 'type' => Controls_Manager::DIMENSIONS,
239 'size_units' => ['px'],
240 'selectors' => [
241 '{{WRAPPER}} .eel-faq-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
242 ],
243 ]
244 );
245
246 // Shadow
247 $this->add_group_control( \Elementor\Group_Control_Box_Shadow::get_type(), [
248 'name' => 'item_shadow',
249 'label' => esc_html__( 'Box Shadow', 'easy-elements' ),
250 'selector' => '{{WRAPPER}} .eel-faq-item',
251 ] );
252
253 $this->add_responsive_control(
254 'item_margin',
255 [
256 'label' => esc_html__('Items Space', 'easy-elements'),
257 'type' => Controls_Manager::SLIDER,
258 'size_units' => ['px'],
259 'selectors' => [
260 '{{WRAPPER}} .eel-faq-accordion' => 'gap: {{SIZE}}{{UNIT}};',
261 ],
262 ]
263 );
264 $this->end_controls_tab();
265
266 $this->start_controls_tab(
267 'item_style_hover',
268 [
269 'label' => esc_html__( 'Hover', 'easy-elements' ),
270 ]
271 );
272 $this->add_group_control(
273 \Elementor\Group_Control_Background::get_type(),
274 [
275 'name' => 'item_bg_hover',
276 'types' => [ 'classic', 'gradient' ],
277 'selector' => '{{WRAPPER}} .eel-faq-item:hover',
278 ]
279 );
280
281 $this->add_group_control(
282 \Elementor\Group_Control_Border::get_type(),
283 [
284 'name' => 'item_border_hover',
285 'selector' => '{{WRAPPER}} .eel-faq-item:hover',
286 ]
287 );
288
289 $this->add_group_control(
290 \Elementor\Group_Control_Box_Shadow::get_type(),
291 [
292 'name' => 'item_shadow_hover',
293 'selector' => '{{WRAPPER}} .eel-faq-item:hover',
294 ]
295 );
296 $this->end_controls_tab();
297
298 $this->start_controls_tab(
299 'item_style_active',
300 [
301 'label' => esc_html__( 'Active', 'easy-elements' ),
302 ]
303 );
304 $this->add_group_control(
305 \Elementor\Group_Control_Background::get_type(),
306 [
307 'name' => 'item_bg_active',
308 'types' => [ 'classic', 'gradient' ],
309 'selector' => '{{WRAPPER}} .eel-faq-item.active',
310 ]
311 );
312
313 $this->add_group_control(
314 \Elementor\Group_Control_Border::get_type(),
315 [
316 'name' => 'item_border_active',
317 'selector' => '{{WRAPPER}} .eel-faq-item.active',
318 ]
319 );
320
321 $this->add_group_control(
322 \Elementor\Group_Control_Box_Shadow::get_type(),
323 [
324 'name' => 'item_shadow_active',
325 'selector' => '{{WRAPPER}} .eel-faq-item.active',
326 ]
327 );
328
329 $this->end_controls_tab();
330 $this->end_controls_tabs();
331
332 $this->end_controls_section();
333
334 $this->start_controls_section(
335 'title_style_section',
336 [
337 'label' => esc_html__( 'Title', 'easy-elements' ),
338 'tab' => Controls_Manager::TAB_STYLE,
339 ]
340 );
341
342 $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [
343 'name' => 'title_typography',
344 'label' => esc_html__( 'Typography', 'easy-elements' ),
345 'selector' => '{{WRAPPER}} .eel-faq-title',
346 ] );
347
348 $this->start_controls_tabs( 'title_style_tabs' );
349
350 $this->start_controls_tab(
351 'title_style_normal',
352 [
353 'label' => esc_html__( 'Normal', 'easy-elements' ),
354 ]
355 );
356
357 $this->add_control( 'title_color', [
358 'label' => esc_html__( 'Color', 'easy-elements' ),
359 'type' => Controls_Manager::COLOR,
360 'selectors' => [
361 '{{WRAPPER}} .eel-faq-title' => 'color: {{VALUE}};',
362 ],
363 ] );
364
365 $this->add_control( 'title_bg_color', [
366 'label' => esc_html__( 'Background Color', 'easy-elements' ),
367 'type' => Controls_Manager::COLOR,
368 'selectors' => [
369 '{{WRAPPER}} .eel-faq-question' => 'background-color: {{VALUE}};',
370 ],
371 ] );
372
373 $this->add_group_control(
374 \Elementor\Group_Control_Border::get_type(),
375 [
376 'name' => 'title_border',
377 'selector' => '{{WRAPPER}} .eel-faq-question',
378 ]
379 );
380
381 $this->add_group_control(
382 \Elementor\Group_Control_Box_Shadow::get_type(),
383 [
384 'name' => 'title_shadow',
385 'selector' => '{{WRAPPER}} .eel-faq-question',
386 ]
387 );
388
389 $this->end_controls_tab();
390
391 $this->start_controls_tab(
392 'title_style_hover',
393 [
394 'label' => esc_html__( 'Hover', 'easy-elements' ),
395 ]
396 );
397
398 $this->add_control( 'title_color_hover', [
399 'label' => esc_html__( 'Color', 'easy-elements' ),
400 'type' => Controls_Manager::COLOR,
401 'selectors' => [
402 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-title' => 'color: {{VALUE}};',
403 ],
404 ] );
405
406 $this->add_control( 'title_bg_color_hover', [
407 'label' => esc_html__( 'Background Color', 'easy-elements' ),
408 'type' => Controls_Manager::COLOR,
409 'selectors' => [
410 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-question' => 'background-color: {{VALUE}};',
411 ],
412 ] );
413
414 $this->add_control( 'title_border_color_hover', [
415 'label' => esc_html__( 'Border Color', 'easy-elements' ),
416 'type' => Controls_Manager::COLOR,
417 'selectors' => [
418 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-question' => 'border-color: {{VALUE}};',
419 ],
420 ] );
421
422 $this->add_group_control(
423 \Elementor\Group_Control_Box_Shadow::get_type(),
424 [
425 'name' => 'title_shadow_hover',
426 'selector' => '{{WRAPPER}} .eel-faq-item:hover .eel-faq-question',
427 ]
428 );
429
430 $this->end_controls_tab();
431
432 $this->start_controls_tab(
433 'title_style_active',
434 [
435 'label' => esc_html__( 'Active', 'easy-elements' ),
436 ]
437 );
438
439 $this->add_control( 'title_color_active', [
440 'label' => esc_html__( 'Color', 'easy-elements' ),
441 'type' => Controls_Manager::COLOR,
442 'selectors' => [
443 '{{WRAPPER}} .eel-faq-item.active .eel-faq-title' => 'color: {{VALUE}};',
444 ],
445 ] );
446
447 $this->add_control( 'title_bg_color_active', [
448 'label' => esc_html__( 'Background Color', 'easy-elements' ),
449 'type' => Controls_Manager::COLOR,
450 'selectors' => [
451 '{{WRAPPER}} .eel-faq-item.active .eel-faq-question' => 'background-color: {{VALUE}};',
452 ],
453 ] );
454
455 $this->add_control( 'title_border_color_active', [
456 'label' => esc_html__( 'Border Color', 'easy-elements' ),
457 'type' => Controls_Manager::COLOR,
458 'selectors' => [
459 '{{WRAPPER}} .eel-faq-item.active .eel-faq-question' => 'border-color: {{VALUE}};',
460 ],
461 ] );
462
463 $this->add_group_control(
464 \Elementor\Group_Control_Box_Shadow::get_type(),
465 [
466 'name' => 'title_shadow_active',
467 'selector' => '{{WRAPPER}} .eel-faq-item.active .eel-faq-question',
468 ]
469 );
470
471 $this->end_controls_tab();
472 $this->end_controls_tabs();
473
474 $this->add_control(
475 'title_style_divider',
476 [
477 'type' => Controls_Manager::DIVIDER,
478 ]
479 );
480
481 $this->add_responsive_control( 'title_border_radius', [
482 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
483 'type' => Controls_Manager::DIMENSIONS,
484 'size_units' => [ 'px', '%' ],
485 'selectors' => [
486 '{{WRAPPER}} .eel-faq-question' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
487 ],
488 ] );
489
490 $this->add_responsive_control( 'title_padding', [
491 'label' => esc_html__( 'Padding', 'easy-elements' ),
492 'type' => Controls_Manager::DIMENSIONS,
493 'size_units' => [ 'px', 'em', '%' ],
494 'selectors' => [
495 '{{WRAPPER}} .eel-faq-question' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
496 ],
497 ] );
498
499 $this->end_controls_section();
500
501 // ===== Description Style =====
502 $this->start_controls_section(
503 'description_style_section',
504 [
505 'label' => esc_html__( 'Description', 'easy-elements' ),
506 'tab' => Controls_Manager::TAB_STYLE,
507 ]
508 );
509
510 $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [
511 'name' => 'description_typography',
512 'label' => esc_html__( 'Typography', 'easy-elements' ),
513 'selector' => '{{WRAPPER}} .eel-faq-answer',
514 ] );
515
516 $this->start_controls_tabs( 'description_style_tabs' );
517
518 $this->start_controls_tab(
519 'description_style_normal',
520 [
521 'label' => esc_html__( 'Normal', 'easy-elements' ),
522 ]
523 );
524
525 $this->add_control( 'description_color', [
526 'label' => esc_html__( 'Color', 'easy-elements' ),
527 'type' => Controls_Manager::COLOR,
528 'selectors' => [
529 '{{WRAPPER}} .eel-faq-answer' => 'color: {{VALUE}};',
530 ],
531 ] );
532
533 $this->add_control( 'description_bg_color', [
534 'label' => esc_html__( 'Background Color', 'easy-elements' ),
535 'type' => Controls_Manager::COLOR,
536 'selectors' => [
537 '{{WRAPPER}} .eel-faq-answer' => 'background-color: {{VALUE}};',
538 ],
539 ] );
540
541 $this->add_group_control(
542 \Elementor\Group_Control_Border::get_type(),
543 [
544 'name' => 'description_border',
545 'selector' => '{{WRAPPER}} .eel-faq-answer',
546 ]
547 );
548
549 $this->end_controls_tab();
550
551 $this->start_controls_tab(
552 'description_style_hover',
553 [
554 'label' => esc_html__( 'Hover', 'easy-elements' ),
555 ]
556 );
557
558 $this->add_control( 'description_color_hover', [
559 'label' => esc_html__( 'Color', 'easy-elements' ),
560 'type' => Controls_Manager::COLOR,
561 'selectors' => [
562 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-answer' => 'color: {{VALUE}};',
563 ],
564 ] );
565
566 $this->add_control( 'description_bg_color_hover', [
567 'label' => esc_html__( 'Background Color', 'easy-elements' ),
568 'type' => Controls_Manager::COLOR,
569 'selectors' => [
570 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-answer' => 'background-color: {{VALUE}};',
571 ],
572 ] );
573
574 $this->add_control( 'description_border_color_hover', [
575 'label' => esc_html__( 'Border Color', 'easy-elements' ),
576 'type' => Controls_Manager::COLOR,
577 'selectors' => [
578 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-answer' => 'border-color: {{VALUE}};',
579 ],
580 ] );
581
582 $this->end_controls_tab();
583
584 $this->start_controls_tab(
585 'description_style_active',
586 [
587 'label' => esc_html__( 'Active', 'easy-elements' ),
588 ]
589 );
590
591 $this->add_control( 'description_color_active', [
592 'label' => esc_html__( 'Color', 'easy-elements' ),
593 'type' => Controls_Manager::COLOR,
594 'selectors' => [
595 '{{WRAPPER}} .eel-faq-item.active .eel-faq-answer' => 'color: {{VALUE}};',
596 ],
597 ] );
598
599 $this->add_control( 'description_bg_color_active', [
600 'label' => esc_html__( 'Background Color', 'easy-elements' ),
601 'type' => Controls_Manager::COLOR,
602 'selectors' => [
603 '{{WRAPPER}} .eel-faq-item.active .eel-faq-answer' => 'background-color: {{VALUE}};',
604 ],
605 ] );
606
607 $this->add_control( 'description_border_color_active', [
608 'label' => esc_html__( 'Border Color', 'easy-elements' ),
609 'type' => Controls_Manager::COLOR,
610 'selectors' => [
611 '{{WRAPPER}} .eel-faq-item.active .eel-faq-answer' => 'border-color: {{VALUE}};',
612 ],
613 ] );
614
615 $this->end_controls_tab();
616 $this->end_controls_tabs();
617
618 $this->add_control(
619 'description_style_divider',
620 [
621 'type' => Controls_Manager::DIVIDER,
622 ]
623 );
624
625 $this->add_responsive_control( 'description_border_radius', [
626 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
627 'type' => Controls_Manager::DIMENSIONS,
628 'size_units' => [ 'px', '%' ],
629 'selectors' => [
630 '{{WRAPPER}} .eel-faq-answer' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
631 ],
632 ] );
633
634 $this->add_responsive_control( 'description_padding', [
635 'label' => esc_html__( 'Padding', 'easy-elements' ),
636 'type' => Controls_Manager::DIMENSIONS,
637 'size_units' => [ 'px', 'em', '%' ],
638 'selectors' => [
639 '{{WRAPPER}} .eel-faq-answer' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
640 ],
641 ] );
642
643 $this->end_controls_section();
644
645 $this->start_controls_section(
646 'icon_style_section',
647 [
648 'label' => esc_html__( 'Accordion Icon', 'easy-elements' ),
649 'tab' => Controls_Manager::TAB_STYLE,
650 ]
651 );
652
653 $this->start_controls_tabs( 'icon_style_tabs' );
654
655 $this->start_controls_tab(
656 'icon_style_normal',
657 [
658 'label' => esc_html__( 'Normal', 'easy-elements' ),
659 ]
660 );
661
662 $this->add_control( 'icon_color', [
663 'label' => esc_html__( 'Color', 'easy-elements' ),
664 'type' => Controls_Manager::COLOR,
665 'selectors' => [
666 '{{WRAPPER}} .eel-faq-icon, {{WRAPPER}} .eel-faq-icon svg' => 'color: {{VALUE}}; fill: {{VALUE}};',
667 ],
668 ] );
669
670 $this->add_control(
671 'icon_bg_color',
672 [
673 'label' => esc_html__( 'Background', 'easy-elements' ),
674 'type' => Controls_Manager::COLOR,
675 'selectors' => [
676 '{{WRAPPER}} .eel-faq-icon' => 'background: {{VALUE}};',
677 ],
678 ]
679 );
680
681 $this->add_responsive_control(
682 'icon_size',
683 [
684 'label' => esc_html__( 'Size', 'easy-elements' ),
685 'type' => \Elementor\Controls_Manager::SLIDER,
686 'size_units' => [ 'px', '%' ],
687 'selectors' => [
688 '{{WRAPPER}} .eel-faq-icon' => 'font-size: {{SIZE}}{{UNIT}};',
689 ],
690 ]
691 );
692
693 $this->add_responsive_control(
694 'icon_box_size',
695 [
696 'label' => esc_html__( 'Box Size', 'easy-elements' ),
697 'type' => \Elementor\Controls_Manager::SLIDER,
698 'size_units' => [ 'px', '%' ],
699 'selectors' => [
700 '{{WRAPPER}} .eel-faq-icon' => implode(
701 '',
702 [
703 'min-width: {{SIZE}}{{UNIT}};',
704 'min-height: {{SIZE}}{{UNIT}};',
705 'width: {{SIZE}}{{UNIT}};',
706 'height: {{SIZE}}{{UNIT}};',
707 'line-height: {{SIZE}}{{UNIT}};',
708 ]
709 ),
710 ]
711 ]
712 );
713
714 $this->add_responsive_control(
715 'icon_position_y',
716 [
717 'label' => esc_html__( 'Vertical Position', 'easy-elements' ),
718 'type' => \Elementor\Controls_Manager::SLIDER,
719 'size_units' => [ 'px', '%' ],
720 'range' => [
721 'px' => [
722 'min' => -100,
723 'max' => 100,
724 'step' => 1,
725 ],
726 '%' => [
727 'min' => -100,
728 'max' => 100,
729 ],
730 ],
731 'default' => [
732 'unit' => 'px',
733 'size' => 0,
734 ],
735 'selectors' => [
736 '{{WRAPPER}} .eel-faq-icon' => 'transform: translateY({{SIZE}}{{UNIT}});',
737 ],
738 ]
739 );
740
741 $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [
742 'name' => 'icon_border',
743 'label' => esc_html__( 'Border', 'easy-elements' ),
744 'selector' => '{{WRAPPER}} .eel-faq-icon',
745 ] );
746
747 $this->add_responsive_control(
748 'icon_border_radius',
749 [
750 'label' => esc_html__('Border Radius', 'easy-elements'),
751 'type' => Controls_Manager::DIMENSIONS,
752 'size_units' => ['px'],
753 'selectors' => [
754 '{{WRAPPER}} .eel-faq-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
755 ],
756 ]
757 );
758 $this->end_controls_tab();
759
760 $this->start_controls_tab(
761 'icon_style_hover',
762 [
763 'label' => esc_html__( 'Hover', 'easy-elements' ),
764 ]
765 );
766 $this->add_control( 'icon_color_hover', [
767 'label' => esc_html__( 'Color', 'easy-elements' ),
768 'type' => Controls_Manager::COLOR,
769 'selectors' => [
770 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-icon, {{WRAPPER}} .eel-faq-item:hover .eel-faq-icon svg path' => 'color: {{VALUE}}; fill: {{VALUE}};',
771 ],
772 ] );
773
774 $this->add_control(
775 'icon_hover_bg_color',
776 [
777 'label' => esc_html__( 'Background', 'easy-elements' ),
778 'type' => Controls_Manager::COLOR,
779 'selectors' => [
780 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-icon' => 'background: {{VALUE}};',
781 ],
782 ]
783 );
784
785 $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [
786 'name' => 'icon_hover_border',
787 'label' => esc_html__( 'Border', 'easy-elements' ),
788 'selector' => '{{WRAPPER}} .eel-faq-item:hover .eel-faq-icon',
789 ] );
790 $this->end_controls_tab();
791
792 $this->start_controls_tab(
793 'icon_style_active',
794 [
795 'label' => esc_html__( 'Active', 'easy-elements' ),
796 ]
797 );
798
799 $this->add_control( 'icon_color_active', [
800 'label' => esc_html__( 'Color', 'easy-elements' ),
801 'type' => Controls_Manager::COLOR,
802 'selectors' => [
803 '{{WRAPPER}} .eel-faq-item.active .eel-faq-icon, {{WRAPPER}} .eel-faq-item.active .eel-faq-icon svg path' => 'color: {{VALUE}}; fill: {{VALUE}};',
804 ],
805 ] );
806
807 $this->add_control(
808 'icon_active_bg_color',
809 [
810 'label' => esc_html__( 'Background', 'easy-elements' ),
811 'type' => Controls_Manager::COLOR,
812 'selectors' => [
813 '{{WRAPPER}} .eel-faq-item.active .eel-faq-icon' => 'background: {{VALUE}};',
814 ],
815 ]
816 );
817
818 $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [
819 'name' => 'icon_active_border',
820 'label' => esc_html__( 'Border', 'easy-elements' ),
821 'selector' => '{{WRAPPER}} .eel-faq-item.active .eel-faq-icon',
822 ] );
823
824 $this->add_responsive_control(
825 'icon_position_y_active',
826 [
827 'label' => esc_html__( 'Vertical Position', 'easy-elements' ),
828 'type' => \Elementor\Controls_Manager::SLIDER,
829 'size_units' => [ 'px', '%' ],
830 'range' => [
831 'px' => [
832 'min' => -100,
833 'max' => 100,
834 'step' => 1,
835 ],
836 '%' => [
837 'min' => -100,
838 'max' => 100,
839 ],
840 ],
841 'default' => [
842 'unit' => 'px',
843 'size' => 0,
844 ],
845 'selectors' => [
846 '{{WRAPPER}} .eel-faq-item.active .eel-faq-icon' => 'transform: translateY({{SIZE}}{{UNIT}});',
847 ],
848 ]
849 );
850
851 $this->end_controls_tab();
852 $this->end_controls_tabs();
853 $this->end_controls_section();
854 }
855
856
857 protected function render() {
858 $settings = $this->get_settings_for_display();
859 if ( empty( $settings['faq_items'] ) ) return;
860
861 $title_tag = tag_escape( $settings['title_tag'] ?? 'h4' );
862 $open_all_class = ( $settings['open_all_toggle'] === 'yes' ) ? 'eel-faq-open-all' : '';
863 $enable_sticky = ( $settings['enable_sticky'] === 'yes' ) ? 'eel-faq-sticky' : '';
864
865
866 ?>
867
868 <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() ); ?>">
869 <?php foreach ( $settings['faq_items'] as $index => $item ) :
870 $is_active = ( ! empty( $item['active_toggle'] ) && $item['active_toggle'] === 'yes' ) ? 'active' : '';
871 $title = isset( $item['title'] ) ? $item['title'] : '';
872 $description = isset( $item['description'] ) ? $item['description'] : '';
873 $icon_open = isset( $settings['icon_open'] ) ? $settings['icon_open'] : array();
874 $icon_close = isset( $settings['icon_close'] ) ? $settings['icon_close'] : array();
875 ?>
876 <div class="eel-faq-item <?php echo esc_attr( $is_active ); ?>">
877 <div class="eel-faq-question">
878 <<?php echo esc_html( $title_tag ); ?> class="eel-faq-title" tabindex="0">
879 <?php echo esc_html( $title ); ?>
880 </<?php echo esc_html( $title_tag ); ?>>
881 <span class="eel-faq-icon eel-faq-icon-open">
882 <?php
883 if ( ! empty( $icon_open ) && ! empty( $icon_open['value'] ) ) {
884 Icons_Manager::render_icon( $icon_open, [ 'aria-hidden' => 'true' ] );
885 } else {
886 echo '<i class="unicon-close" aria-hidden="true"></i>';
887 }
888 ?>
889 </span>
890 <span class="eel-faq-icon eel-faq-icon-close">
891 <?php
892 if ( ! empty( $icon_close ) && ! empty( $icon_close['value'] ) ) {
893 Icons_Manager::render_icon( $icon_close, [ 'aria-hidden' => 'true' ] );
894 } else {
895 echo '<i class="unicon-add" aria-hidden="true"></i>';
896 }
897 ?>
898 </span>
899 </div>
900 <div class="eel-faq-answer">
901 <?php echo wp_kses_post( $description ); ?>
902 </div>
903 </div>
904 <?php endforeach; ?>
905 </div>
906 <?php
907 }
908 }