PluginProbe ʕ •ᴥ•ʔ
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 3.5.0
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v3.5.0
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 / accordion / accordion.php
elementskit-lite / widgets / accordion Last commit date
accordion-handler.php 3 years ago accordion.php 1 year ago
accordion.php
1023 lines
1 <?php
2 namespace Elementor;
3
4 use \Elementor\ElementsKit_Widget_Accordion_Handler as Handler;
5 use \ElementsKit_Lite\Modules\Controls\Controls_Manager as ElementsKit_Controls_Manager;
6
7 if (! defined( 'ABSPATH' ) ) exit;
8
9 class ElementsKit_Widget_Accordion extends Widget_Base {
10 use \ElementsKit_Lite\Widgets\Widget_Notice;
11
12 public $base;
13
14 public function get_name() {
15 return Handler::get_name();
16 }
17
18 public function get_title() {
19 return Handler::get_title();
20 }
21
22 public function get_icon() {
23 return Handler::get_icon();
24 }
25
26 public function get_categories() {
27 return Handler::get_categories();
28 }
29
30 public function get_keywords() {
31 return Handler::get_keywords();
32 }
33
34 public function get_help_url() {
35 return 'https://wpmet.com/doc/accordion/';
36 }
37
38 protected function is_dynamic_content(): bool {
39 return false;
40 }
41
42 public function has_widget_inner_wrapper(): bool {
43 return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
44 }
45
46 protected function register_controls() {
47
48
49 $this->start_controls_section(
50 'section_tab', [
51 'label' =>esc_html__( 'Accordion', 'elementskit-lite' ),
52 ]
53 );
54 $repeater = new Repeater();
55
56
57 $repeater->add_control(
58 'acc_title', [
59 'label' => esc_html__('Title', 'elementskit-lite'),
60 'type' => Controls_Manager::TEXT,
61 'dynamic' => [
62 'active' => true,
63 ],
64 'label_block' => true,
65 'default' => 'Accordion Item',
66 ]
67 );
68
69 $repeater->add_control(
70 'ekit_acc_is_active',
71 [
72 'label' => esc_html__('Keep this slide open? ', 'elementskit-lite'),
73 'type' => Controls_Manager::SWITCHER,
74 'default' => 'no',
75 'label_on' =>esc_html__( 'Yes', 'elementskit-lite' ),
76 'label_off' =>esc_html__( 'No', 'elementskit-lite' ),
77 ]
78 );
79
80 $repeater->add_control(
81 'acc_content', [
82 'label' => esc_html__('Description', 'elementskit-lite'),
83 'type' => Controls_Manager::WYSIWYG,
84 'dynamic' => [
85 'active' => true,
86 ],
87 'label_block' => true,
88 'default' => 'Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast',
89 ]
90 );
91
92 $this->add_control(
93 'ekit_accordion_items',
94 [
95 'label' => esc_html__('Content', 'elementskit-lite'),
96 'type' => Controls_Manager::REPEATER,
97 'separator' => 'before',
98 'title_field' => '{{ acc_title }}',
99 'default' => [
100 [
101 'acc_title' => 'How to Change my Photo from Admin Dashboard?',
102 'acc_content' => 'Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast',
103 'ekit_acc_is_active' => 'yes'
104 ],
105 [
106 'acc_title' => 'How to Change my Password easily?',
107 'acc_content' => 'Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast',
108 ],
109 [
110 'acc_title' => 'How to Change my Subscription Plan using PayPal',
111 'acc_content' => 'Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast',
112 ],
113 ],
114 'fields' => $repeater->get_controls(),
115 ]
116 );
117 $this->add_control(
118 'ekit_accordion_open_first_slide',
119 [
120 'label' => esc_html__( 'Keep first slide auto open?', 'elementskit-lite' ),
121 'type' => Controls_Manager::SWITCHER,
122 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ),
123 'label_off' => esc_html__( 'No', 'elementskit-lite' ),
124 'return_value' => 'yes',
125 'default' => 'yes',
126 ]
127 );
128
129 $this->add_control(
130 'ekit_accordion_style',
131 [
132 'label' =>esc_html__( 'Style', 'elementskit-lite' ),
133 'type' => Controls_Manager::SELECT,
134 'default' => 'accoedion-primary',
135 'options' => [
136 'accoedion-primary' =>esc_html__( 'Primary', 'elementskit-lite' ),
137 'curve-shape' =>esc_html__( 'Curve Shape', 'elementskit-lite' ),
138 'accoedion-primary side-curve' =>esc_html__( 'Side Curve', 'elementskit-lite' ),
139 'accordion-4' =>esc_html__( 'Box Icon', 'elementskit-lite' ),
140 'floating-style' =>esc_html__( 'Floating Style', 'elementskit-lite' ),
141 ],
142 ]
143 );
144 $this->add_control(
145 'ekit_accordian_faq_schema',
146 [
147 'label' => esc_html__( 'Accordian FAQ Schema', 'elementskit-lite' ),
148 'type' => Controls_Manager::SWITCHER,
149 'separator' => 'before',
150 ]
151 );
152 $this->end_controls_section();
153 // Icon setting
154 $this->start_controls_section(
155 'ekit_accordion_section_setting', [
156 'label' =>esc_html__( 'Icon', 'elementskit-lite' ),
157 ]
158 );
159 $this->add_control(
160 'ekit_accordion_icon_pos_style',
161 [
162 'label' => esc_html__( 'Icon Position', 'elementskit-lite' ),
163 'type' => Controls_Manager::SELECT,
164 'default' => 'right',
165 'options' => [
166 'right' => esc_html__( 'Right', 'elementskit-lite' ),
167 'left' => esc_html__( 'Left', 'elementskit-lite' ),
168 'bothside' => esc_html__( 'Both side', 'elementskit-lite' ),
169 ],
170 ]
171 );
172
173 $this->add_control(
174 'ekit_accordion_display_loop_count',
175 [
176 'label' => esc_html__( 'Show Loop Count', 'elementskit-lite' ),
177 'type' => Controls_Manager::SWITCHER,
178 'label_on' => esc_html__( 'Show', 'elementskit-lite' ),
179 'label_off' => esc_html__( 'Hide', 'elementskit-lite' ),
180 'return_value' => 'yes',
181 'default' => 'no',
182 'condition' => [
183 'ekit_accordion_icon_pos_style' => 'right',
184 ]
185 ]
186 );
187 $this->add_control(
188 'ekit_accordion_left_icons',
189 [
190 'label' => esc_html__( 'Left Icon', 'elementskit-lite' ),
191 'type' => Controls_Manager::ICONS,
192 'fa4compatibility' => 'ekit_accordion_left_icon',
193 'default' => [
194 'value' => 'icon icon-down-arrow1',
195 'library' => 'ekiticons',
196 ],
197 'condition' => [
198 'ekit_accordion_icon_pos_style' => ['left', 'bothside']
199 ]
200 ]
201 );
202 $this->add_control(
203 'ekit_accordion_left_icon_actives',
204 [
205 'label' => esc_html__( 'Left Icon Active', 'elementskit-lite' ),
206 'type' => Controls_Manager::ICONS,
207 'fa4compatibility' => 'ekit_accordion_left_icon_active',
208 'default' => [
209 'value' => 'icon icon-up-arrow1',
210 'library' => 'ekiticons',
211 ],
212 'condition' => [
213 'ekit_accordion_icon_pos_style' => ['left', 'bothside']
214 ]
215 ]
216 );
217 $this->add_control(
218 'ekit_accordion_right_icons',
219 [
220 'label' => esc_html__( 'Right Icon', 'elementskit-lite' ),
221 'type' => Controls_Manager::ICONS,
222 'fa4compatibility' => 'ekit_accordion_right_icon',
223 'default' => [
224 'value' => 'icon icon-down-arrow1',
225 'library' => 'ekiticons',
226 ],
227 'condition' => [
228 'ekit_accordion_icon_pos_style' => ['right', 'bothside']
229 ]
230 ]
231 );
232 $this->add_control(
233 'ekit_accordion_right_icon_actives',
234 [
235 'label' => esc_html__( 'Right Icon Active', 'elementskit-lite' ),
236 'type' => Controls_Manager::ICONS,
237 'fa4compatibility' => 'ekit_accordion_right_icon_active',
238 'default' => [
239 'value' => 'icon icon-up-arrow',
240 'library' => 'ekiticons',
241 ],
242 'condition' => [
243 'ekit_accordion_icon_pos_style' => ['right', 'bothside']
244 ]
245 ]
246 );
247 $this->end_controls_section();
248
249 //Title Style Section
250
251 $this->start_controls_section(
252 'ekit_accordion_section_title_style', [
253 'label' =>esc_html__( 'Title', 'elementskit-lite' ),
254 'tab' => Controls_Manager::TAB_STYLE,
255 ]
256 );
257 $this->add_group_control(
258 Group_Control_Typography::get_type(), [
259 'name' => 'ekit_accordion_title_typography',
260 'selector' => '{{WRAPPER}} .elementskit-accordion .elementskit-card-header>.elementskit-btn-link',
261 ]
262 );
263 $this->start_controls_tabs(
264 'ekit_accordion_style_tabs'
265 );
266 $this->start_controls_tab(
267 'ekit_accordion_style_open_tab',
268 [
269 'label' => esc_html__( 'Open', 'elementskit-lite' ),
270 ]
271 );
272 $this->add_control(
273 'ekit_accordion_title_color', [
274 'label' =>esc_html__( 'Color', 'elementskit-lite' ),
275 'type' => Controls_Manager::COLOR,
276 'selectors' => [
277 '{{WRAPPER}} .elementskit-accordion .elementskit-card .elementskit-card-header>.elementskit-btn-link[aria-expanded="true"]' => 'color: {{VALUE}};',
278 '{{WRAPPER}} .elementskit-accordion.curve-shape .elementskit-card-header>.elementskit-btn-link[aria-expanded=true]' => 'color: {{VALUE}};'
279 ],
280 ]
281 );
282
283 $this->add_group_control(
284 Group_Control_Background::get_type(),
285 [
286 'name' => 'ekit_accordion_background',
287 'label' => esc_html__( 'Background', 'elementskit-lite' ),
288 'types' => [ 'classic', 'gradient' ],
289 'condition' => [
290 'ekit_accordion_style!' => ['curve-shape']
291 ],
292 'selector' => '{{WRAPPER}} .elementskit-accordion.accoedion-primary .elementskit-card .elementskit-card-header>.elementskit-btn-link[aria-expanded="true"], {{WRAPPER}} .elementskit-accordion .elementskit-card-header>.elementskit-btn-link[aria-expanded=true], {{WRAPPER}} .elementskit-accordion.floating-style .elementskit-card .elementskit-btn-link[aria-expanded="true"]',
293 ]
294 );
295 $this->add_control(
296 'ekit_accordion_curve_fill_color', [
297 'label' =>esc_html__( 'Background Color', 'elementskit-lite' ),
298 'type' => Controls_Manager::COLOR,
299 'condition' => [
300 'ekit_accordion_style' => ['curve-shape']
301 ],
302 'selectors' => [
303 '{{WRAPPER}} .elementskit-accordion.curve-shape .elementskit-card-header>.elementskit-btn-link[aria-expanded=true] .path' => 'fill: {{VALUE}}',
304 ],
305 ]
306 );
307 $this->add_control(
308 'ekit_accordion_curve_stroke_color', [
309 'label' =>esc_html__( 'Border Color', 'elementskit-lite' ),
310 'type' => Controls_Manager::COLOR,
311 'condition' => [
312 'ekit_accordion_style' => ['curve-shape']
313 ],
314 'selectors' => [
315 '{{WRAPPER}} .elementskit-accordion.curve-shape .elementskit-card-header>.elementskit-btn-link[aria-expanded=true] .path' => 'stroke: {{VALUE}};',
316 ],
317 ]
318 );
319
320
321 $this->add_group_control(
322 Group_Control_Border::get_type(),
323 [
324 'name' => 'ekit_accordion_title_border_open',
325 'label' => esc_html__( 'Border', 'elementskit-lite' ),
326 'condition' => [
327 'ekit_accordion_style!' => ['curve-shape']
328 ],
329 'selector' => '{{WRAPPER}} .elementskit-accordion .elementskit-card .elementskit-card-header>.elementskit-btn-link[aria-expanded="true"]',
330 ]
331 );
332
333 $this->add_control(
334 'ekit_accordion_border_radious_curve_shape_open',
335 [
336 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ),
337 'type' => Controls_Manager::DIMENSIONS,
338 'size_units' => [ 'px', '%', 'em' ],
339 'condition' => [
340 'ekit_accordion_style!' => ['curve-shape']
341 ],
342 'selectors' => [
343 '{{WRAPPER}} .elementskit-accordion .elementskit-card .elementskit-card-header>.elementskit-btn-link[aria-expanded="true"]' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
344 ],
345 ]
346 );
347 $this->add_group_control(
348 Group_Control_Box_Shadow::get_type(),
349 [
350 'name' => 'ekit_accordion_box_shadow_open',
351 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ),
352 'selector' => '{{WRAPPER}} .elementskit-accordion .elementskit-card .elementskit-card-header>.elementskit-btn-link[aria-expanded="true"]',
353 ]
354 );
355
356 $this->end_controls_tab();
357
358 $this->start_controls_tab(
359 'ekit_accordion_style_close_tab',
360 [
361 'label' => esc_html__( 'Closed', 'elementskit-lite' ),
362 ]
363 );
364 $this->add_control(
365 'ekit_accordion_title_color_close', [
366 'label' =>esc_html__( 'Color', 'elementskit-lite' ),
367 'type' => Controls_Manager::COLOR,
368 'selectors' => [
369 '{{WRAPPER}} .elementskit-accordion .elementskit-card-header>.elementskit-btn-link' => 'color: {{VALUE}};'
370 ],
371 ]
372 );
373 $this->add_group_control(
374 Group_Control_Background::get_type(),
375 [
376 'name' => 'ekit_accordion_background_close',
377 'label' => esc_html__( 'Background', 'elementskit-lite' ),
378 'types' => [ 'classic', 'gradient' ],
379 'condition' => [
380 'ekit_accordion_style!' => ['curve-shape']
381 ],
382 'selector' => '{{WRAPPER}} .elementskit-accordion .elementskit-card-header>.elementskit-btn-link',
383 ]
384 );
385 $this->add_control(
386 'ekit_accordion_curve_fill_close', [
387 'label' =>esc_html__( 'Background', 'elementskit-lite' ),
388 'type' => Controls_Manager::COLOR,
389 'condition' => [
390 'ekit_accordion_style' => ['curve-shape']
391 ],
392 'selectors' => [
393 '{{WRAPPER}} .elementskit-accordion .elementskit-card-header>.elementskit-btn-link .path' => 'fill: {{VALUE}};',
394 ],
395 ]
396 );
397 $this->add_control(
398 'ekit_accordion_curve_stroke_close', [
399 'label' =>esc_html__( 'Border Color', 'elementskit-lite' ),
400 'type' => Controls_Manager::COLOR,
401 'condition' => [
402 'ekit_accordion_style' => ['curve-shape']
403 ],
404 'selectors' => [
405 '{{WRAPPER}} .elementskit-accordion .elementskit-card-header>.elementskit-btn-link .path' => 'stroke: {{VALUE}};',
406 ],
407 ]
408 );
409
410
411 $this->add_group_control(
412 Group_Control_Border::get_type(),
413 [
414 'name' => 'ekit_accordion_title_border_close',
415 'label' => esc_html__( 'Border', 'elementskit-lite' ),
416 'condition' => [
417 'ekit_accordion_style!' => ['curve-shape']
418 ],
419 'selector' => '{{WRAPPER}} .elementskit-accordion .elementskit-card-header>.elementskit-btn-link',
420 ]
421 );
422 $this->add_control(
423 'ekit_accordion_border_radious_close',
424 [
425 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ),
426 'type' => Controls_Manager::DIMENSIONS,
427 'size_units' => [ 'px', '%', 'em' ],
428 'condition' => [
429 'ekit_accordion_style!' => ['curve-shape']
430 ],
431 'selectors' => [
432 '{{WRAPPER}} .elementskit-accordion .elementskit-card-header>.elementskit-btn-link' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
433 ],
434 ]
435 );
436
437 $this->add_group_control(
438 Group_Control_Box_Shadow::get_type(),
439 [
440 'name' => 'ekit_accordion_box_shadow_close',
441 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ),
442 'selector' => '{{WRAPPER}} .elementskit-accordion .elementskit-card-header>.elementskit-btn-link',
443 ]
444 );
445 $this->end_controls_tab();
446
447 $this->end_controls_tabs();
448
449 $this->add_control(
450 'ekit_accordion_title_divide',
451 [
452 'type' => Controls_Manager::DIVIDER,
453 'style' => 'thick',
454 ]
455 );
456
457 $this->add_responsive_control(
458 'ekit_accordion_title_padding',
459 [
460 'label' => esc_html__( 'Padding', 'elementskit-lite' ),
461 'type' => Controls_Manager::DIMENSIONS,
462 'size_units' => [ 'px' ],
463 'selectors' => [
464 '{{WRAPPER}} .elementskit-accordion .elementskit-card-header>.elementskit-btn-link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
465 ],
466 ]
467 );
468
469 $this->add_responsive_control(
470 'ekit_accordion_title_margin_bottom', [
471 'label' =>esc_html__( 'Margin Bottom', 'elementskit-lite' ),
472 'type' => Controls_Manager::SLIDER,
473 'default' => [
474 'size' => '',
475 ],
476 'range' => [
477 'px' => [
478 'min' => -30,
479 'max' => 100,
480 'step' => 1,
481 ],
482 ],
483 'size_units' => ['px'],
484 'selectors' => [
485 '{{WRAPPER}} .elementskit-accordion .elementskit-card:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};',
486 ],
487 ]
488 );
489
490 $this->end_controls_section();
491
492 //Subtitle Style Section
493 $this->start_controls_section(
494 'ekit_accordion_section_content_style', [
495 'label' =>esc_html__( 'Description', 'elementskit-lite' ),
496 'tab' => Controls_Manager::TAB_STYLE,
497 ]
498 );
499
500 $this->add_control(
501 'ekit_accordion_content_color', [
502 'label' =>esc_html__( 'Color', 'elementskit-lite' ),
503 'type' => Controls_Manager::COLOR,
504 'selectors' => [
505 '{{WRAPPER}} .elementskit-accordion .elementskit-card-body p' => 'color: {{VALUE}};',
506 '{{WRAPPER}} .elementskit-accordion .elementskit-card-body' => 'color: {{VALUE}};',
507 ],
508 ]
509 );
510
511 $this->add_group_control(
512 Group_Control_Typography::get_type(), [
513 'name' => 'ekit_accordion_content_typography',
514 'selector' => '{{WRAPPER}} .elementskit-accordion .elementskit-card-body p, {{WRAPPER}} .elementskit-accordion .elementskit-card-body',
515 ]
516 );
517
518 $this->add_group_control(
519 Group_Control_Background::get_type(),
520 [
521 'name' => 'ekit_accordion_content_background',
522 'label' => esc_html__( 'Background', 'elementskit-lite' ),
523 'types' => [ 'classic', 'gradient' ],
524 'selector' => '{{WRAPPER}} .elementskit-accordion .elementskit-card-body, {{WRAPPER}} .accordion.floating-style .elementskit-card-body',
525 ]
526 );
527
528 $this->add_control(
529 'ekit_accordion_content_border_radious',
530 [
531 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ),
532 'type' => Controls_Manager::DIMENSIONS,
533 'size_units' => [ 'px', '%', 'em' ],
534 'selectors' => [
535 '{{WRAPPER}} .elementskit-accordion .elementskit-card-body' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
536 ],
537 ]
538 );
539
540 $this->add_responsive_control(
541 'ekit_accordion_content_padding',
542 [
543 'label' => esc_html__( 'Padding', 'elementskit-lite' ),
544 'type' => Controls_Manager::DIMENSIONS,
545 'size_units' => [ 'px', '%', 'em' ],
546 'selectors' => [
547 '{{WRAPPER}} .elementskit-accordion .elementskit-card-body' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
548 ],
549 ]
550 );
551
552 $this->add_responsive_control(
553 'ekit_accordion_content_width',
554 [
555 'label' => esc_html__( 'Width', 'elementskit-lite' ),
556 'type' => Controls_Manager::SLIDER,
557 'size_units' => [ '%' ],
558 'range' => [
559 '%' => [
560 'min' => 0,
561 'max' => 100,
562 ],
563 ],
564 'default' => [
565 'unit' => '%',
566 'size' => 90,
567 ],
568 'selectors' => [
569 '{{WRAPPER}} .elementskit-accordion.floating-style .elementskit-card-body' => 'max-width: {{SIZE}}{{UNIT}};',
570 ],
571 'condition' => [
572 'ekit_accordion_style' => 'floating-style'
573 ]
574 ]
575 );
576
577 $this->end_controls_section();
578
579 //Slide border
580 $this->start_controls_section(
581 'ekit_accordion_section_border_style', [
582 'label' =>esc_html__( 'Border', 'elementskit-lite' ),
583 'tab' => Controls_Manager::TAB_STYLE,
584 ]
585 );
586
587 $this->start_controls_tabs(
588 'border_style_tabs'
589 );
590
591 $this->start_controls_tab(
592 'style_open_tab',
593 [
594 'label' => esc_html__( 'OPEN', 'elementskit-lite' ),
595 ]
596 );
597
598 $this->add_group_control(
599 Group_Control_Border::get_type(),
600 [
601 'name' => 'ekit_accordion_border_closed',
602 'label' => esc_html__( 'Border', 'elementskit-lite' ),
603 'selector' => '{{WRAPPER}} .elementskit-accordion > .elementskit-card.active',
604 ]
605 );
606
607 $this->add_control(
608 'ekit_accordion_border_radious_closed',
609 [
610 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ),
611 'type' => Controls_Manager::DIMENSIONS,
612 'size_units' => [ 'px', '%', 'em' ],
613 'selectors' => [
614 '{{WRAPPER}} .elementskit-accordion > .elementskit-card.active' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
615 '{{WRAPPER}} .elementskit-accordion .elementskit-card-header > .elementskit-btn-link' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} 0{{UNIT}} 0{{UNIT}};',
616 ],
617 ]
618 );
619
620 $this->add_group_control(
621 Group_Control_Box_Shadow::get_type(),
622 [
623 'name' => 'ekit_accordion_element_box_shadow_group_closed',
624 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ),
625 'selector' => '{{WRAPPER}} .elementskit-accordion > .elementskit-card.active',
626 ]
627 );
628
629 $this->end_controls_tab();
630
631 $this->start_controls_tab(
632 'style_close_tab',
633 [
634 'label' => esc_html__( 'CLOSED', 'elementskit-lite' ),
635 ]
636 );
637
638 $this->add_group_control(
639 Group_Control_Border::get_type(),
640 [
641 'name' => 'ekit_accordion_border_open',
642 'label' => esc_html__( 'Border', 'elementskit-lite' ),
643 'selector' => '{{WRAPPER}} .elementskit-accordion > .elementskit-card',
644 ]
645 );
646
647 $this->add_control(
648 'ekit_accordion_border_radious_open',
649 [
650 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ),
651 'type' => Controls_Manager::DIMENSIONS,
652 'size_units' => [ 'px', '%', 'em' ],
653 'selectors' => [
654 '{{WRAPPER}} .elementskit-accordion > .elementskit-card' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
655 '{{WRAPPER}} .elementskit-accordion .elementskit-card-header > .elementskit-btn-link.collapsed' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
656 ],
657 ]
658 );
659
660 $this->add_group_control(
661 Group_Control_Box_Shadow::get_type(),
662 [
663 'name' => 'ekit_accordion_element_box_shadow_group',
664 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ),
665 'selector' => '{{WRAPPER}} .elementskit-accordion > .elementskit-card',
666 ]
667 );
668
669 $this->end_controls_tab();
670
671 $this->end_controls_tabs();
672
673 $this->add_control(
674 'ekit_accordion_last_child_border_bottom',
675 [
676 'label' => esc_html__( 'Disable Border for last Element?', 'elementskit-lite' ),
677 'type' => Controls_Manager::SWITCHER,
678 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ),
679 'label_off' => esc_html__( 'No', 'elementskit-lite' ),
680 'default' => '',
681 'return_value' => 'yes',
682 'separator' => 'before',
683 'selectors' => [
684 '{{WRAPPER}} .ekit-wid-con > .elementskit-accordion > .elementskit-card:last-child' => 'border: 0px;',
685 ]
686 ]
687 );
688
689 $this->end_controls_section();
690
691 //Icon Style Section
692 $this->start_controls_section(
693 'ekit_accordion_section_icon_style', [
694 'label' =>esc_html__( 'Icon', 'elementskit-lite' ),
695 'tab' => Controls_Manager::TAB_STYLE,
696 ]
697 );
698
699 $this->start_controls_tabs(
700 'ekit_accordion_style_tabs_icon'
701 );
702 $this->start_controls_tab(
703 'ekit_accordion_icon_open_tab',
704 [
705 'label' => esc_html__( 'Slide Closed Icon', 'elementskit-lite' ),
706 ]
707 );
708
709 $this->add_responsive_control(
710 'ekit_accordion_icon_typography_close',
711 [
712 'label' => esc_html__( 'Size', 'elementskit-lite' ),
713 'type' => Controls_Manager::SLIDER,
714 'range' => [
715 'px' => [
716 'min' => 6,
717 'max' => 300,
718 ],
719 ],
720 'selectors' => [
721 '{{WRAPPER}} .elementskit-accordion .elementskit-card-header .elementskit-btn-link .ekit_accordion_normal_icon' => 'font-size: {{SIZE}}{{UNIT}};'
722 ],
723 ]
724 );
725
726 $this->add_control(
727 'ekit_accordion_icon_color_close', [
728 'label' =>esc_html__( 'Color', 'elementskit-lite' ),
729 'type' => Controls_Manager::COLOR,
730 'selectors' => [
731 '{{WRAPPER}} .elementskit-accordion .elementskit-card-header .elementskit-btn-link .ekit_accordion_normal_icon' => 'color: {{VALUE}}; fill: {{VALUE}};',
732 ],
733 ]
734 );
735
736 $this->add_control(
737 'ekit_accordion_icon_box_open_bg_hr',
738 [
739 'type' => Controls_Manager::DIVIDER,
740 'style' => 'thick',
741 'condition' => [
742 'ekit_accordion_style' => 'accordion-4'
743 ]
744 ]
745 );
746
747 $this->add_group_control(
748 Group_Control_Background::get_type(),
749 [
750 'name' => 'ekit_accordion_icon_box_open_bg',
751 'label' => esc_html__( 'Background', 'elementskit-lite' ),
752 'types' => [ 'classic', 'gradient' ],
753 'selector' => '{{WRAPPER}} .elementskit-accordion.accordion-4 .elementskit-card-header .elementskit-btn-link::before',
754 'condition' => [
755 'ekit_accordion_style' => 'accordion-4'
756 ]
757 ]
758 );
759
760 $this->add_group_control(
761 Group_Control_Background::get_type(),
762 [
763 'name' => 'ekit_accordion_icon_box_bg',
764 'label' => esc_html__( 'Background', 'elementskit-lite' ),
765 'types' => [ 'classic', 'gradient' ],
766 'selector' => '{{WRAPPER}} .elementskit-accordion .elementskit-card-header .elementskit-btn-link[aria-expanded="false"] > .ekit_accordion_icon_group',
767 ]
768 );
769
770 $this->add_group_control(
771 Group_Control_Border::get_type(),
772 [
773 'name' => 'ekit_accordion_icon_border',
774 'label' => esc_html__( 'Border', 'elementskit-lite' ),
775 'selector' => '{{WRAPPER}} .elementskit-accordion .elementskit-card-header .elementskit-btn-link[aria-expanded="false"] > .ekit_accordion_icon_group',
776 ]
777 );
778
779 $this->end_controls_tab();
780 $this->start_controls_tab(
781 'ekit_accordion_icon_close_tab',
782 [
783 'label' => esc_html__( ' Slide Open icon', 'elementskit-lite' ),
784 ]
785 );
786
787 $this->add_responsive_control(
788 'ekit_accordion_icon_typography', //icon id different because replaced the previous control
789 [
790 'label' => esc_html__( 'Size', 'elementskit-lite' ),
791 'type' => Controls_Manager::SLIDER,
792 'range' => [
793 'px' => [
794 'min' => 6,
795 'max' => 300,
796 ],
797 ],
798 'selectors' => [
799 '{{WRAPPER}} .elementskit-accordion .elementskit-card .elementskit-card-header .elementskit-btn-link .ekit_accordion_active_icon' => 'font-size: {{SIZE}}{{UNIT}};',
800 ]
801 ]
802 );
803
804 $this->add_control(
805 'ekit_accordion_icon_color', [
806 'label' =>esc_html__( 'Color', 'elementskit-lite' ),
807 'type' => Controls_Manager::COLOR,
808 'selectors' => [
809 '{{WRAPPER}} .elementskit-accordion .elementskit-card .elementskit-card-header .elementskit-btn-link .ekit_accordion_active_icon' => 'color: {{VALUE}}; fill: {{VALUE}};',
810 ],
811 ]
812 );
813
814 $this->add_control(
815 'ekit_accordion_icon_box_close_bg_hr',
816 [
817 'type' => Controls_Manager::DIVIDER,
818 'style' => 'thick',
819 'condition' => [
820 'ekit_accordion_style' => 'accordion-4'
821 ]
822 ]
823 );
824
825 $this->add_group_control(
826 Group_Control_Background::get_type(),
827 [
828 'name' => 'ekit_accordion_icon_box_close_bg',
829 'label' => esc_html__( 'Background', 'elementskit-lite' ),
830 'types' => [ 'classic', 'gradient' ],
831 'selector' => '{{WRAPPER}} .elementskit-accordion.accordion-4 .elementskit-card-header .elementskit-btn-link[aria-expanded="true"]::before',
832 'condition' => [
833 'ekit_accordion_style' => ['accordion-4']
834 ]
835 ]
836 );
837
838 $this->add_group_control(
839 Group_Control_Background::get_type(),
840 [
841 'name' => 'ekit_accordion_closed_icon_bg',
842 'label' => esc_html__( 'Background', 'elementskit-lite' ),
843 'types' => [ 'classic', 'gradient' ],
844 'selector' => '{{WRAPPER}} .elementskit-accordion .elementskit-card-header .elementskit-btn-link .ekit_accordion_icon_group',
845 ]
846 );
847
848 $this->add_group_control(
849 Group_Control_Border::get_type(),
850 [
851 'name' => 'ekit_accordion_closed_icon_border',
852 'label' => esc_html__( 'Border', 'elementskit-lite' ),
853 'selector' => '{{WRAPPER}} .elementskit-accordion .elementskit-card-header .elementskit-btn-link .ekit_accordion_icon_group',
854 ]
855 );
856
857 $this->end_controls_tab();
858
859 $this->end_controls_tabs();
860
861 $this->add_control(
862 'ekit_accordion_icon_border_radious',
863 [
864 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ),
865 'type' => Controls_Manager::DIMENSIONS,
866 'size_units' => [ 'px', '%', 'em' ],
867 'separator' => 'before',
868 'selectors' => [
869 '{{WRAPPER}} .elementskit-accordion .elementskit-card-header .elementskit-btn-link .ekit_accordion_icon_group' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
870 ],
871 ]
872 );
873
874 $this->add_responsive_control(
875 'ekit_accordion_icon_padding',
876 [
877 'label' => esc_html__( 'Padding', 'elementskit-lite' ),
878 'type' => Controls_Manager::DIMENSIONS,
879 'size_units' => [ 'px', '%', 'em' ],
880 'selectors' => [
881 '{{WRAPPER}} .elementskit-accordion .elementskit-card .elementskit-card-header .elementskit-btn-link .ekit_accordion_icon_group' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
882 ],
883 ]
884 );
885
886 $this->add_responsive_control(
887 'ekit_accordion_section_icon_margin',
888 [
889 'label' => esc_html__( 'Margin', 'elementskit-lite' ),
890 'type' => Controls_Manager::DIMENSIONS,
891 'size_units' => [ 'px', '%', 'em' ],
892 'selectors' => [
893 '{{WRAPPER}} .ekit_accordion_icon_group, {{WRAPPER}} .ekit_accordion_icon_left_group' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
894 ],
895 ]
896 );
897
898 $this->end_controls_section();
899
900 $this->insert_pro_message();
901 }
902
903 protected function render( ) {
904 echo '<div class="ekit-wid-con" >';
905 $this->render_raw();
906 echo '</div>';
907 }
908
909 protected function render_raw( ) {
910
911 $settings = $this->get_settings_for_display();
912
913 extract($settings);
914
915 $has_user_defined_active_tab = false;
916 foreach($ekit_accordion_items as $tab){
917 if($tab['ekit_acc_is_active'] == 'yes'){
918 $has_user_defined_active_tab = true;
919 }
920 }
921 $acc_id = uniqid();
922
923 ?>
924
925 <div class="elementskit-accordion <?php echo esc_attr( $ekit_accordion_style ); ?>" id="accordion-<?php echo esc_attr($acc_id); ?>">
926
927 <?php
928
929 foreach ($ekit_accordion_items as $i=>$accorion_content) :
930 $is_active = ($accorion_content['ekit_acc_is_active'] == 'yes') ? ' show collapse' : ' collapse';
931 $is_active = ($ekit_accordion_open_first_slide == 'yes' && $has_user_defined_active_tab == false && $i == 0) ? ' show collapse' : $is_active;
932 ?>
933
934 <div class="elementskit-card <?php echo esc_attr($is_active == ' collapse' ? '' : 'active'); ?>">
935 <div class="elementskit-card-header" id="primaryHeading-<?php echo esc_attr($i); ?>-<?php echo esc_attr($this->get_id()); ?>">
936 <a href="#collapse-<?php echo esc_attr($accorion_content['_id'].$acc_id)?>" class="ekit-accordion--toggler elementskit-btn-link collapsed" data-ekit-toggle="collapse" data-target="#Collapse-<?php echo esc_attr($accorion_content['_id'].$acc_id)?>" aria-expanded="<?php echo esc_attr($is_active == ' collapse' ? 'false' : 'true'); ?>" aria-controls="Collapse-<?php echo esc_attr($accorion_content['_id'].$acc_id)?>">
937 <?php if(($ekit_accordion_icon_pos_style == 'left') || ($ekit_accordion_icon_pos_style == 'bothside')) : ?>
938 <div class="ekit_accordion_icon_left_group">
939 <div class="ekit_accordion_normal_icon">
940 <!-- Normal Icon -->
941 <?php Icons_Manager::render_icon($settings['ekit_accordion_left_icons']); ?>
942 </div>
943
944 <div class="ekit_accordion_active_icon">
945 <!-- Active Icon -->
946 <?php Icons_Manager::render_icon($settings['ekit_accordion_left_icon_actives']); ?>
947 </div>
948 </div>
949
950 <?php endif;
951
952 if($ekit_accordion_display_loop_count == 'yes') : ?>
953
954 <span class="number"></span>
955
956 <?php endif; ?>
957
958 <span class="ekit-accordion-title"><?php echo esc_html($accorion_content['acc_title']); ?></span>
959
960 <?php if(($ekit_accordion_icon_pos_style == 'right') || ($ekit_accordion_icon_pos_style == 'bothside')) : ?>
961
962 <div class="ekit_accordion_icon_group">
963 <div class="ekit_accordion_normal_icon">
964 <!-- Normal Icon -->
965 <?php Icons_Manager::render_icon($settings['ekit_accordion_right_icons']); ?>
966 </div>
967
968 <div class="ekit_accordion_active_icon">
969 <!-- Active Icon -->
970 <?php Icons_Manager::render_icon($settings['ekit_accordion_right_icon_actives']); ?>
971 </div>
972 </div>
973
974 <?php endif; ?>
975
976 <?php if ( $ekit_accordion_style == 'curve-shape' ): ?>
977 <svg version="1.1" class="svg-shape" x="0px" y="0px" viewBox="0 0 541 64" height="64" preserveAspectRatio="none">
978 <polygon class="path" points="85,55 81,55 51,55 42.5,64 34,55 0,55 0,0 34.4,0 42.5,9.5 50.6,0 81,0 85,0 541,0 541,55 "/>
979 </svg>
980 <?php endif; ?>
981 </a>
982 </div>
983
984 <div id="Collapse-<?php echo esc_attr($accorion_content['_id'].$acc_id)?>" class="<?php echo esc_attr($is_active); ?>" aria-labelledby="primaryHeading-<?php echo esc_attr($i); ?>-<?php echo esc_attr($this->get_id()); ?>" data-parent="#accordion-<?php echo esc_attr($acc_id); ?>">
985
986 <div class="elementskit-card-body ekit-accordion--content">
987 <?php echo do_shortcode( \ElementsKit_Lite\Utils::kses( $accorion_content['acc_content'] ) ); ?>
988 </div>
989
990 </div>
991
992 </div><!-- .elementskit-card END -->
993
994 <?php endforeach; ?>
995 <?php
996 if ( isset( $settings['ekit_accordian_faq_schema'] ) && 'yes' === $settings['ekit_accordian_faq_schema'] ) {
997 $json = [
998 '@context' => 'https://schema.org',
999 '@type' => 'FAQPage',
1000 'mainEntity' => [],
1001 ];
1002
1003 foreach ( $settings['ekit_accordion_items'] as $index => $item ) {
1004 $faq_schema_text = !empty( $item['acc_content'] ) ? $item['acc_content'] : '';
1005 $json['mainEntity'][] = [
1006 '@type' => 'Question',
1007 'name' => esc_html($item['acc_title']),
1008 'acceptedAnswer' => [
1009 '@type' => 'Answer',
1010 'text' => \ElementsKit_Lite\Utils::kses($faq_schema_text ) ,
1011 ],
1012 ];
1013 }
1014 ?>
1015 <script type="application/ld+json"><?php echo wp_json_encode( $json, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); ?></script>
1016 <?php
1017 }
1018 ?>
1019 </div>
1020 <?php
1021 }
1022 }
1023