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

733 lines 21.1 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->start_controls_tabs( 'title_style_tabs' );
343
344 $this->start_controls_tab(
345 'title_style_normal',
346 [
347 'label' => esc_html__( 'Normal', 'easy-elements' ),
348 ]
349 );
350
351 // Title Color
352 $this->add_control( 'title_color', [
353 'label' => esc_html__( 'Color', 'easy-elements' ),
354 'type' => Controls_Manager::COLOR,
355 'selectors' => [
356 '{{WRAPPER}} .eel-faq-title' => 'color: {{VALUE}};',
357 ],
358 ] );
359
360 // Title Typography
361 $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [
362 'name' => 'title_typography',
363 'label' => esc_html__( 'Typography', 'easy-elements' ),
364 'selector' => '{{WRAPPER}} .eel-faq-title',
365 ] );
366 $this->end_controls_tab();
367
368 $this->start_controls_tab(
369 'title_style_hover',
370 [
371 'label' => esc_html__( 'Hover', 'easy-elements' ),
372 ]
373 );
374 $this->add_control( 'title_color_hover', [
375 'label' => esc_html__( 'Color', 'easy-elements' ),
376 'type' => Controls_Manager::COLOR,
377 'selectors' => [
378 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-title' => 'color: {{VALUE}};',
379 ],
380 ] );
381 $this->end_controls_tab();
382 $this->start_controls_tab(
383 'title_style_active',
384 [
385 'label' => esc_html__( 'Active', 'easy-elements' ),
386 ]
387 );
388 $this->add_control( 'title_color_active', [
389 'label' => esc_html__( 'Color', 'easy-elements' ),
390 'type' => Controls_Manager::COLOR,
391 'selectors' => [
392 '{{WRAPPER}} .eel-faq-item.active .eel-faq-title' => 'color: {{VALUE}};',
393 ],
394 ] );
395 $this->end_controls_tab();
396 $this->end_controls_tabs();
397 $this->end_controls_section();
398
399 $this->start_controls_section(
400 'description_style_section',
401 [
402 'label' => esc_html__( 'Description', 'easy-elements' ),
403 'tab' => Controls_Manager::TAB_STYLE,
404 ]
405 );
406
407 $this->start_controls_tabs( 'description_style_tabs' );
408
409 $this->start_controls_tab(
410 'description_style_normal',
411 [
412 'label' => esc_html__( 'Normal', 'easy-elements' ),
413 ]
414 );
415
416 // Description Color
417 $this->add_control( 'description_color', [
418 'label' => esc_html__( 'Color', 'easy-elements' ),
419 'type' => Controls_Manager::COLOR,
420 'selectors' => [
421 '{{WRAPPER}} .eel-faq-answer' => 'color: {{VALUE}};',
422 ],
423 ] );
424
425 // Description Typography
426 $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [
427 'name' => 'description_typography',
428 'label' => esc_html__( 'Typography', 'easy-elements' ),
429 'selector' => '{{WRAPPER}} .eel-faq-answer',
430 ] );
431
432 $this->end_controls_tab();
433
434 $this->start_controls_tab(
435 'description_style_hover',
436 [
437 'label' => esc_html__( 'Hover', 'easy-elements' ),
438 ]
439 );
440
441 $this->add_control( 'description_color_hover', [
442 'label' => esc_html__( 'Color', 'easy-elements' ),
443 'type' => Controls_Manager::COLOR,
444 'selectors' => [
445 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-answer' => 'color: {{VALUE}};',
446 ],
447 ] );
448 $this->end_controls_tab();
449
450 $this->start_controls_tab(
451 'description_style_active',
452 [
453 'label' => esc_html__( 'Active', 'easy-elements' ),
454 ]
455 );
456
457 $this->add_control( 'description_color_active', [
458 'label' => esc_html__( 'Color', 'easy-elements' ),
459 'type' => Controls_Manager::COLOR,
460 'selectors' => [
461 '{{WRAPPER}} .eel-faq-item.active .eel-faq-answer' => 'color: {{VALUE}};',
462 ],
463 ] );
464
465 $this->end_controls_tab();
466 $this->end_controls_tabs();
467
468 $this->end_controls_section();
469
470 $this->start_controls_section(
471 'icon_style_section',
472 [
473 'label' => esc_html__( 'Accordion Icon', 'easy-elements' ),
474 'tab' => Controls_Manager::TAB_STYLE,
475 ]
476 );
477
478 $this->start_controls_tabs( 'icon_style_tabs' );
479
480 $this->start_controls_tab(
481 'icon_style_normal',
482 [
483 'label' => esc_html__( 'Normal', 'easy-elements' ),
484 ]
485 );
486
487 $this->add_control( 'icon_color', [
488 'label' => esc_html__( 'Color', 'easy-elements' ),
489 'type' => Controls_Manager::COLOR,
490 'selectors' => [
491 '{{WRAPPER}} .eel-faq-icon, {{WRAPPER}} .eel-faq-icon svg' => 'color: {{VALUE}}; fill: {{VALUE}};',
492 ],
493 ] );
494
495 $this->add_control(
496 'icon_bg_color',
497 [
498 'label' => esc_html__( 'Background', 'easy-elements' ),
499 'type' => Controls_Manager::COLOR,
500 'selectors' => [
501 '{{WRAPPER}} .eel-faq-icon' => 'background: {{VALUE}};',
502 ],
503 ]
504 );
505
506 $this->add_responsive_control(
507 'icon_size',
508 [
509 'label' => esc_html__( 'Size', 'easy-elements' ),
510 'type' => \Elementor\Controls_Manager::SLIDER,
511 'size_units' => [ 'px', '%' ],
512 'selectors' => [
513 '{{WRAPPER}} .eel-faq-icon' => 'font-size: {{SIZE}}{{UNIT}};',
514 ],
515 ]
516 );
517
518 $this->add_responsive_control(
519 'icon_box_size',
520 [
521 'label' => esc_html__( 'Box Size', 'easy-elements' ),
522 'type' => \Elementor\Controls_Manager::SLIDER,
523 'size_units' => [ 'px', '%' ],
524 'selectors' => [
525 '{{WRAPPER}} .eel-faq-icon' => implode(
526 '',
527 [
528 'min-width: {{SIZE}}{{UNIT}};',
529 'min-height: {{SIZE}}{{UNIT}};',
530 'width: {{SIZE}}{{UNIT}};',
531 'height: {{SIZE}}{{UNIT}};',
532 'line-height: {{SIZE}}{{UNIT}};',
533 ]
534 ),
535 ]
536 ]
537 );
538
539 $this->add_responsive_control(
540 'icon_position_y',
541 [
542 'label' => esc_html__( 'Vertical Position', 'easy-elements' ),
543 'type' => \Elementor\Controls_Manager::SLIDER,
544 'size_units' => [ 'px', '%' ],
545 'range' => [
546 'px' => [
547 'min' => -100,
548 'max' => 100,
549 'step' => 1,
550 ],
551 '%' => [
552 'min' => -100,
553 'max' => 100,
554 ],
555 ],
556 'default' => [
557 'unit' => 'px',
558 'size' => 0,
559 ],
560 'selectors' => [
561 '{{WRAPPER}} .eel-faq-icon' => 'transform: translateY({{SIZE}}{{UNIT}});',
562 ],
563 ]
564 );
565
566 $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [
567 'name' => 'icon_border',
568 'label' => esc_html__( 'Border', 'easy-elements' ),
569 'selector' => '{{WRAPPER}} .eel-faq-icon',
570 ] );
571
572 $this->add_responsive_control(
573 'icon_border_radius',
574 [
575 'label' => esc_html__('Border Radius', 'easy-elements'),
576 'type' => Controls_Manager::DIMENSIONS,
577 'size_units' => ['px'],
578 'selectors' => [
579 '{{WRAPPER}} .eel-faq-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
580 ],
581 ]
582 );
583 $this->end_controls_tab();
584
585 $this->start_controls_tab(
586 'icon_style_hover',
587 [
588 'label' => esc_html__( 'Hover', 'easy-elements' ),
589 ]
590 );
591 $this->add_control( 'icon_color_hover', [
592 'label' => esc_html__( 'Color', 'easy-elements' ),
593 'type' => Controls_Manager::COLOR,
594 'selectors' => [
595 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-icon, {{WRAPPER}} .eel-faq-item:hover .eel-faq-icon svg path' => 'color: {{VALUE}}; fill: {{VALUE}};',
596 ],
597 ] );
598
599 $this->add_control(
600 'icon_hover_bg_color',
601 [
602 'label' => esc_html__( 'Background', 'easy-elements' ),
603 'type' => Controls_Manager::COLOR,
604 'selectors' => [
605 '{{WRAPPER}} .eel-faq-item:hover .eel-faq-icon' => 'background: {{VALUE}};',
606 ],
607 ]
608 );
609
610 $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [
611 'name' => 'icon_hover_border',
612 'label' => esc_html__( 'Border', 'easy-elements' ),
613 'selector' => '{{WRAPPER}} .eel-faq-item:hover .eel-faq-icon',
614 ] );
615 $this->end_controls_tab();
616
617 $this->start_controls_tab(
618 'icon_style_active',
619 [
620 'label' => esc_html__( 'Active', 'easy-elements' ),
621 ]
622 );
623
624 $this->add_control( 'icon_color_active', [
625 'label' => esc_html__( 'Color', 'easy-elements' ),
626 'type' => Controls_Manager::COLOR,
627 'selectors' => [
628 '{{WRAPPER}} .eel-faq-item.active .eel-faq-icon, {{WRAPPER}} .eel-faq-item.active .eel-faq-icon svg path' => 'color: {{VALUE}}; fill: {{VALUE}};',
629 ],
630 ] );
631
632 $this->add_control(
633 'icon_active_bg_color',
634 [
635 'label' => esc_html__( 'Background', 'easy-elements' ),
636 'type' => Controls_Manager::COLOR,
637 'selectors' => [
638 '{{WRAPPER}} .eel-faq-item.active .eel-faq-icon' => 'background: {{VALUE}};',
639 ],
640 ]
641 );
642
643 $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [
644 'name' => 'icon_active_border',
645 'label' => esc_html__( 'Border', 'easy-elements' ),
646 'selector' => '{{WRAPPER}} .eel-faq-item.active .eel-faq-icon',
647 ] );
648
649 $this->add_responsive_control(
650 'icon_position_y_active',
651 [
652 'label' => esc_html__( 'Vertical Position', 'easy-elements' ),
653 'type' => \Elementor\Controls_Manager::SLIDER,
654 'size_units' => [ 'px', '%' ],
655 'range' => [
656 'px' => [
657 'min' => -100,
658 'max' => 100,
659 'step' => 1,
660 ],
661 '%' => [
662 'min' => -100,
663 'max' => 100,
664 ],
665 ],
666 'default' => [
667 'unit' => 'px',
668 'size' => 0,
669 ],
670 'selectors' => [
671 '{{WRAPPER}} .eel-faq-item.active .eel-faq-icon' => 'transform: translateY({{SIZE}}{{UNIT}});',
672 ],
673 ]
674 );
675
676 $this->end_controls_tab();
677 $this->end_controls_tabs();
678 $this->end_controls_section();
679 }
680
681
682 protected function render() {
683 $settings = $this->get_settings_for_display();
684 if ( empty( $settings['faq_items'] ) ) return;
685
686 $title_tag = tag_escape( $settings['title_tag'] ?? 'h4' );
687 $open_all_class = ( $settings['open_all_toggle'] === 'yes' ) ? 'eel-faq-open-all' : '';
688 $enable_sticky = ( $settings['enable_sticky'] === 'yes' ) ? 'eel-faq-sticky' : '';
689
690
691 ?>
692
693 <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() ); ?>">
694 <?php foreach ( $settings['faq_items'] as $index => $item ) :
695 $is_active = ( ! empty( $item['active_toggle'] ) && $item['active_toggle'] === 'yes' ) ? 'active' : '';
696 $title = isset( $item['title'] ) ? $item['title'] : '';
697 $description = isset( $item['description'] ) ? $item['description'] : '';
698 $icon_open = isset( $settings['icon_open'] ) ? $settings['icon_open'] : array();
699 $icon_close = isset( $settings['icon_close'] ) ? $settings['icon_close'] : array();
700 ?>
701 <div class="eel-faq-item <?php echo esc_attr( $is_active ); ?>">
702 <div class="eel-faq-question">
703 <<?php echo esc_html( $title_tag ); ?> class="eel-faq-title" tabindex="0">
704 <?php echo esc_html( $title ); ?>
705 </<?php echo esc_html( $title_tag ); ?>>
706 <span class="eel-faq-icon eel-faq-icon-open">
707 <?php
708 if ( ! empty( $icon_open ) && ! empty( $icon_open['value'] ) ) {
709 Icons_Manager::render_icon( $icon_open, [ 'aria-hidden' => 'true' ] );
710 } else {
711 echo '<i class="unicon-close" aria-hidden="true"></i>';
712 }
713 ?>
714 </span>
715 <span class="eel-faq-icon eel-faq-icon-close">
716 <?php
717 if ( ! empty( $icon_close ) && ! empty( $icon_close['value'] ) ) {
718 Icons_Manager::render_icon( $icon_close, [ 'aria-hidden' => 'true' ] );
719 } else {
720 echo '<i class="unicon-add" aria-hidden="true"></i>';
721 }
722 ?>
723 </span>
724 </div>
725 <div class="eel-faq-answer">
726 <?php echo wp_kses_post( $description ); ?>
727 </div>
728 </div>
729 <?php endforeach; ?>
730 </div>
731 <?php
732 }
733 }