PluginProbe
Bricksable for Bricks Builder / 1.4.2
Bricksable for Bricks Builder v1.4.2
1.2.9 1.3.0 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 1.4.1 1.4.2 1.4.3 1.4.31 1.4.32 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 All 132 releases
bricksable / includes / elements / element-icon-list.php

element-icon-list.php in Bricksable for Bricks Builder 1.4.2, at includes/elements/element-icon-list.php

1,038 lines 26.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly.
5 }
6
7 class Bricksable_IconList extends \Bricks\Element {
8
9 public $category = 'bricksable';
10 public $name = 'ba-icon-list';
11 public $icon = 'ti-list';
12
13 public function get_label() {
14 return esc_html__( 'Icon List', 'bricksable' );
15 }
16
17 public function set_control_groups() {
18
19 $this->control_groups['items'] = array(
20 'title' => esc_html__( 'Items', 'bricksable' ),
21 'tab' => 'content',
22 );
23
24 $this->control_groups['item'] = array(
25 'title' => esc_html__( 'List item', 'bricksable' ),
26 'tab' => 'content',
27 );
28
29 $this->control_groups['highlight'] = array(
30 'title' => esc_html__( 'Highlight', 'bricksable' ),
31 'tab' => 'content',
32 );
33
34 $this->control_groups['title'] = array(
35 'title' => esc_html__( 'Title', 'bricksable' ),
36 'tab' => 'content',
37 );
38
39 $this->control_groups['icon'] = array(
40 'title' => esc_html__( 'Icon', 'bricksable' ),
41 'tab' => 'content',
42 );
43
44 $this->control_groups['meta'] = array(
45 'title' => esc_html__( 'Meta', 'bricksable' ),
46 'tab' => 'content',
47 );
48
49 $this->control_groups['description'] = array(
50 'title' => esc_html__( 'Description', 'bricksable' ),
51 'tab' => 'content',
52 );
53
54 $this->control_groups['separator'] = array(
55 'title' => esc_html__( 'Separator', 'bricksable' ),
56 'tab' => 'content',
57 );
58
59 }
60
61 public function set_controls() {
62
63 /**
64 * Items
65 */
66
67 $this->controls['items'] = array(
68 'tab' => 'content',
69 'group' => 'items',
70 'placeholder' => esc_html__( 'List items', 'bricksable' ),
71 'type' => 'repeater',
72 'titleProperty' => 'title',
73 'fields' => array(
74 'title' => array(
75 'label' => esc_html__( 'Title', 'bricksable' ),
76 'type' => 'text',
77 'hasDynamicData' => 'text',
78 'inlineEditing' => array(
79 'selector' => '.title',
80 ),
81 ),
82
83 'icon' => array(
84 'label' => esc_html__( 'Icon', 'bricksable' ),
85 'type' => 'icon',
86 'required' => array( 'use_icon_text', '!=', true ),
87 ),
88
89 'use_icon_text' => array(
90 'label' => esc_html__( 'Use Icon Text', 'bricksable' ),
91 'type' => 'checkbox',
92 'inline' => true,
93 ),
94
95 'icon_text' => array(
96 'label' => esc_html__( 'Icon Text', 'bricksable' ),
97 'type' => 'text',
98 'hasDynamicData' => 'text',
99 'required' => array( 'use_icon_text', '=', true ),
100 ),
101
102 'use_icon_image' => array(
103 'label' => esc_html__( 'Use Icon Image', 'bricksable' ),
104 'type' => 'checkbox',
105 'inline' => true,
106 ),
107
108 'icon_image' => array(
109 'label' => esc_html__( 'Icon Image', 'bricksable' ),
110 'type' => 'image',
111 'hasDynamicData' => 'image',
112 'required' => array( 'use_icon_image', '=', true ),
113 ),
114
115 'link' => array(
116 'label' => esc_html__( 'Link title', 'bricksable' ),
117 'type' => 'link',
118 ),
119
120 'meta' => array(
121 'label' => esc_html__( 'Meta', 'bricksable' ),
122 'type' => 'text',
123 'hasDynamicData' => 'text',
124 ),
125
126 'description' => array(
127 'label' => esc_html__( 'Description', 'bricksable' ),
128 'type' => 'textarea',
129 'hasDynamicData' => 'text',
130 ),
131
132 'highlight' => array(
133 'label' => esc_html__( 'Highlight', 'bricksable' ),
134 'type' => 'checkbox',
135 ),
136
137 'highlightLabel' => array(
138 'label' => esc_html__( 'Highlight label', 'bricksable' ),
139 'type' => 'text',
140 'inline' => true,
141 'required' => array( 'highlight', '!=', '' ),
142 ),
143 ),
144 'default' => array(
145 array(
146 'title' => esc_html__( 'Icon List item #1', 'bricksable' ),
147 'icon' => array(
148 'library' => 'themify',
149 'icon' => 'ti-check-box',
150 ),
151 ),
152 array(
153 'title' => esc_html__( 'Icon List item #2', 'bricksable' ),
154 'icon' => array(
155 'library' => 'themify',
156 'icon' => 'ti-check-box',
157 ),
158 ),
159 ),
160 );
161
162 /**
163 * List item
164 */
165
166 $this->controls['itemMargin'] = array(
167 'tab' => 'content',
168 'group' => 'item',
169 'label' => esc_html__( 'Margin', 'bricksable' ),
170 'type' => 'dimensions',
171 'css' => array(
172 array(
173 'property' => 'margin',
174 'selector' => 'li.list-item:not(:last-child)',
175 ),
176 ),
177 );
178
179 $this->controls['itemPadding'] = array(
180 'tab' => 'content',
181 'group' => 'item',
182 'label' => esc_html__( 'Padding', 'bricksable' ),
183 'type' => 'dimensions',
184 'css' => array(
185 array(
186 'property' => 'padding',
187 'selector' => '.content-wrapper',
188 ),
189 ),
190 );
191
192 $this->controls['item_verticalAlign'] = array(
193 'tab' => 'content',
194 'group' => 'item',
195 'label' => esc_html__( 'Vertical align', 'bricksable' ),
196 'type' => 'align-items',
197 'exclude' => array(
198 'stretch',
199 ),
200 'css' => array(
201 array(
202 'property' => 'align-items',
203 'selector' => '.title-wrapper',
204 ),
205 ),
206 'inline' => true,
207 'default' => 'center',
208 'placeholder' => esc_html__( 'Center', 'bricksable' ),
209 );
210
211 $this->controls['itemJustifyContent'] = array(
212 'tab' => 'content',
213 'group' => 'item',
214 'label' => esc_html__( 'Align', 'bricksable' ),
215 'type' => 'justify-content',
216 'exclude' => array(
217 'space-between',
218 'space-around',
219 'space-evenly',
220 ),
221 'css' => array(
222 array(
223 'property' => 'justify-content',
224 'selector' => '.title-wrapper',
225 ),
226 ),
227 'inline' => true,
228 );
229
230 $this->controls['itemDirection'] = array(
231 'tab' => 'content',
232 'group' => 'item',
233 'label' => esc_html__( 'Direction', 'bricksable' ),
234 'title' => 'flex-direction',
235 'type' => 'select',
236 'options' => array(
237 'row' => esc_html__( 'Horizontal', 'bricksable' ),
238 'row-reverse' => esc_html__( 'Horizontal reversed', 'bricksable' ),
239 ),
240 'css' => array(
241 array(
242 'property' => 'flex-direction',
243 'selector' => '.title-wrapper',
244 ),
245 ),
246 'default' => 'row',
247 'inline' => true,
248 );
249
250 $this->controls['item_indent'] = array(
251 'tab' => 'content',
252 'group' => 'item',
253 'label' => esc_html__( 'Indent Gap', 'bricksable' ),
254 'type' => 'slider',
255 'css' => array(
256 array(
257 'property' => 'gap',
258 'selector' => '.title-wrapper',
259 ),
260 ),
261 'units' => array(
262 'px' => array(
263 'min' => 1,
264 'max' => 40,
265 'step' => 1,
266 ),
267 'em' => array(
268 'min' => 1,
269 'max' => 20,
270 'step' => 0.1,
271 ),
272 ),
273 'default' => '7px',
274 'description' => esc_html__( 'Set the gap distance element within container.', 'bricksable' ),
275 );
276
277 $this->controls['itemOddBackground'] = array(
278 'tab' => 'content',
279 'group' => 'item',
280 'label' => esc_html__( 'Odd background', 'bricksable' ),
281 'type' => 'color',
282 'css' => array(
283 array(
284 'property' => 'background-color',
285 'selector' => 'li:nth-child(odd)',
286 ),
287 ),
288 'inline' => true,
289 'small' => true,
290 );
291
292 $this->controls['itemEvenBackground'] = array(
293 'tab' => 'content',
294 'group' => 'item',
295 'label' => esc_html__( 'Even background', 'bricksable' ),
296 'type' => 'color',
297 'css' => array(
298 array(
299 'property' => 'background-color',
300 'selector' => 'li:nth-child(even)',
301 ),
302 ),
303 'inline' => true,
304 'small' => true,
305 );
306
307 $this->controls['itemBorder'] = array(
308 'tab' => 'content',
309 'group' => 'settings',
310 'label' => esc_html__( 'Border', 'bricksable' ),
311 'type' => 'border',
312 'css' => array(
313 array(
314 'property' => 'border',
315 'selector' => 'li',
316 ),
317 ),
318 'inline' => true,
319 'small' => true,
320 );
321
322 $this->controls['itemAutoWidth'] = array(
323 'tab' => 'content',
324 'group' => 'item',
325 'label' => esc_html__( 'Auto width', 'bricksable' ),
326 'type' => 'checkbox',
327 'css' => array(
328 array(
329 'property' => 'justify-content',
330 'selector' => '.title-wrapper',
331 'value' => 'initial',
332 ),
333 array(
334 'property' => 'flex-grow',
335 'selector' => '.separator',
336 'value' => '0',
337 ),
338 ),
339 );
340
341 /**
342 * Highlight
343 */
344
345 $this->controls['highlightBlock'] = array(
346 'tab' => 'content',
347 'group' => 'highlight',
348 'label' => esc_html__( 'Block', 'bricksable' ),
349 'type' => 'checkbox',
350 'css' => array(
351 array(
352 'property' => 'display',
353 'selector' => '.highlight',
354 'value' => 'block',
355 ),
356 ),
357 );
358
359 $this->controls['highlightLabelPadding'] = array(
360 'tab' => 'content',
361 'group' => 'highlight',
362 'label' => esc_html__( 'Label padding', 'bricksable' ),
363 'type' => 'dimensions',
364 'css' => array(
365 array(
366 'property' => 'padding',
367 'selector' => '.highlight',
368 ),
369 ),
370 );
371
372 $this->controls['highlightLabelBackground'] = array(
373 'tab' => 'content',
374 'group' => 'highlight',
375 'label' => esc_html__( 'Label background', 'bricksable' ),
376 'type' => 'color',
377 'css' => array(
378 array(
379 'property' => 'background-color',
380 'selector' => '.highlight',
381 ),
382 ),
383 'inline' => true,
384 'small' => true,
385 );
386
387 $this->controls['highlightLabelBorder'] = array(
388 'tab' => 'content',
389 'group' => 'highlight',
390 'label' => esc_html__( 'Label border', 'bricksable' ),
391 'type' => 'border',
392 'css' => array(
393 array(
394 'property' => 'border',
395 'selector' => '.highlight',
396 ),
397 ),
398 'inline' => true,
399 'small' => true,
400 );
401
402 $this->controls['highlightLabelTypography'] = array(
403 'tab' => 'content',
404 'group' => 'highlight',
405 'label' => esc_html__( 'Label typography', 'bricksable' ),
406 'type' => 'typography',
407 'css' => array(
408 array(
409 'property' => 'font',
410 'selector' => '.highlight',
411 ),
412 ),
413 'inline' => true,
414 'small' => true,
415 );
416
417 $this->controls['highlightContentPadding'] = array(
418 'tab' => 'content',
419 'group' => 'highlight',
420 'label' => esc_html__( 'Content padding', 'bricksable' ),
421 'type' => 'dimensions',
422 'css' => array(
423 array(
424 'property' => 'padding',
425 'selector' => '.highlighted .content-wrapper',
426 ),
427 ),
428 );
429
430 $this->controls['highlightContentBackground'] = array(
431 'tab' => 'content',
432 'group' => 'highlight',
433 'label' => esc_html__( 'Content background', 'bricksable' ),
434 'type' => 'color',
435 'css' => array(
436 array(
437 'property' => 'background-color',
438 'selector' => '.highlighted .content-wrapper',
439 ),
440 ),
441 'inline' => true,
442 'small' => true,
443 );
444
445 $this->controls['highlightContentBorder'] = array(
446 'tab' => 'content',
447 'group' => 'highlight',
448 'label' => esc_html__( 'Content border', 'bricksable' ),
449 'type' => 'border',
450 'css' => array(
451 array(
452 'property' => 'border',
453 'selector' => '.highlighted .content-wrapper',
454 ),
455 ),
456 'inline' => true,
457 'small' => true,
458 );
459
460 $this->controls['highlightContentColor'] = array(
461 'tab' => 'content',
462 'group' => 'highlight',
463 'label' => esc_html__( 'Content text color', 'bricksable' ),
464 'type' => 'color',
465 'css' => array(
466 array(
467 'property' => 'color',
468 'selector' => '.highlighted .content-wrapper .title',
469 ),
470 array(
471 'property' => 'color',
472 'selector' => '.highlighted .content-wrapper .meta',
473 ),
474 array(
475 'property' => 'color',
476 'selector' => '.highlighted .content-wrapper .description',
477 ),
478 ),
479 'inline' => true,
480 'small' => true,
481 );
482
483 // Icon.
484 $this->controls['icon_margin'] = array(
485 'tab' => 'content',
486 'group' => 'icon',
487 'label' => esc_html__( 'Margin', 'bricksable' ),
488 'type' => 'dimensions',
489 'css' => array(
490 array(
491 'property' => 'margin',
492 'selector' => '.icon',
493 ),
494 array(
495 'property' => 'margin',
496 'selector' => '.ba-icon-list-icon',
497 ),
498 array(
499 'property' => 'margin',
500 'selector' => '.ba-icon-list-icon-image',
501 ),
502 ),
503 );
504
505 $this->controls['icon_padding'] = array(
506 'tab' => 'content',
507 'group' => 'icon',
508 'label' => esc_html__( 'Padding', 'bricksable' ),
509 'type' => 'dimensions',
510 'css' => array(
511 array(
512 'property' => 'padding',
513 'selector' => '.icon',
514 ),
515 array(
516 'property' => 'padding',
517 'selector' => '.ba-icon-list-icon',
518 ),
519 array(
520 'property' => 'padding',
521 'selector' => '.ba-icon-list-icon-image',
522 ),
523 ),
524 );
525
526 $this->controls['icon_circle'] = array(
527 'tab' => 'content',
528 'group' => 'icon',
529 'label' => esc_html__( 'Circle', 'bricksable' ),
530 'type' => 'checkbox',
531 );
532
533 $this->controls['iconHeight'] = array(
534 'tab' => 'content',
535 'group' => 'icon',
536 'label' => esc_html__( 'Icon height', 'bricksable' ),
537 'type' => 'slider',
538 'units' => array(
539 'px' => array(
540 'min' => 1,
541 'max' => 200,
542 'step' => 1,
543 ),
544 ),
545 'css' => array(
546 array(
547 'property' => 'height',
548 'selector' => '.icon',
549 ),
550 array(
551 'property' => 'line-height',
552 'selector' => '.icon',
553 ),
554 array(
555 'property' => 'height',
556 'selector' => '.ba-icon-list-icon',
557 ),
558 array(
559 'property' => 'line-height',
560 'selector' => '.ba-icon-list-icon',
561 ),
562 ),
563 );
564
565 $this->controls['iconWidth'] = array(
566 'tab' => 'content',
567 'group' => 'icon',
568 'label' => esc_html__( 'Icon width', 'bricksable' ),
569 'type' => 'slider',
570 'units' => array(
571 'px' => array(
572 'min' => 1,
573 'max' => 200,
574 'step' => 1,
575 ),
576 ),
577 'css' => array(
578 array(
579 'property' => 'width',
580 'selector' => '.icon',
581 ),
582 array(
583 'property' => 'width',
584 'selector' => '.ba-icon-list-icon',
585 ),
586 ),
587 );
588
589 $this->controls['icon_image_width'] = array(
590 'tab' => 'content',
591 'group' => 'icon',
592 'label' => esc_html__( 'Icon Image Width', 'bricksable' ),
593 'type' => 'slider',
594 'css' => array(
595 array(
596 'property' => 'max-width',
597 'selector' => '.ba-icon-list-icon-image',
598 ),
599 ),
600 'units' => array(
601 '%' => array(
602 'min' => 1,
603 'max' => 100,
604 'step' => 1,
605 ),
606 ),
607 'description' => esc_html__( 'Adjust the icon image width.', 'bricksable' ),
608 );
609
610 $this->controls['icon_background'] = array(
611 'tab' => 'content',
612 'group' => 'icon',
613 'label' => esc_html__( 'Icon background', 'bricksable' ),
614 'type' => 'color',
615 'css' => array(
616 array(
617 'property' => 'background-color',
618 'selector' => '.icon',
619 ),
620 array(
621 'property' => 'background-color',
622 'selector' => '.ba-icon-list-icon',
623 ),
624 array(
625 'property' => 'background-color',
626 'selector' => '.ba-icon-list-icon-image',
627 ),
628 ),
629 'inline' => true,
630 'small' => true,
631 );
632
633 $this->controls['icon_typography'] = array(
634 'tab' => 'content',
635 'group' => 'icon',
636 'label' => esc_html__( 'Icon typography', 'bricksable' ),
637 'type' => 'typography',
638 'exclude' => array(
639 'font-family',
640 'font-weight',
641 'text-align',
642 'text-transform',
643 'line-height',
644 'letter-spacing',
645 ),
646 'css' => array(
647 array(
648 'property' => 'font',
649 'selector' => '.icon',
650 ),
651 ),
652 'inline' => true,
653 'small' => true,
654 );
655
656 $this->controls['icon_text_typography'] = array(
657 'tab' => 'content',
658 'group' => 'icon',
659 'label' => esc_html__( 'Icon Text typography', 'bricksable' ),
660 'type' => 'typography',
661 'css' => array(
662 array(
663 'property' => 'font',
664 'selector' => '.ba-icon-list-icon',
665 ),
666 ),
667 'inline' => true,
668 'small' => true,
669 );
670
671 $this->controls['icon_border'] = array(
672 'tab' => 'content',
673 'group' => 'icon',
674 'label' => esc_html__( 'Icon border', 'bricksable' ),
675 'type' => 'border',
676 'css' => array(
677 array(
678 'property' => 'border',
679 'selector' => '.icon',
680 ),
681 array(
682 'property' => 'border',
683 'selector' => '.ba-icon-list-icon',
684 ),
685 array(
686 'property' => 'border',
687 'selector' => '.ba-icon-list-icon-image',
688 ),
689 ),
690 'inline' => true,
691 'small' => true,
692 );
693
694 $this->controls['icon_boxshadow'] = array(
695 'tab' => 'content',
696 'group' => 'icon',
697 'label' => esc_html__( 'Icon box shadow', 'bricksable' ),
698 'type' => 'box-shadow',
699 'css' => array(
700 array(
701 'property' => 'box-shadow',
702 'selector' => '.icon',
703 ),
704 array(
705 'property' => 'box-shadow',
706 'selector' => '.ba-icon-list-icon',
707 ),
708 array(
709 'property' => 'box-shadow',
710 'selector' => '.ba-icon-list-icon-image',
711 ),
712 ),
713 'inline' => true,
714 'small' => true,
715 );
716
717 /**
718 * Title
719 */
720
721 $this->controls['titleMargin'] = array(
722 'tab' => 'content',
723 'group' => 'title',
724 'label' => esc_html__( 'Margin', 'bricksable' ),
725 'type' => 'dimensions',
726 'css' => array(
727 array(
728 'property' => 'margin',
729 'selector' => '.title',
730 ),
731 ),
732 );
733
734 $this->controls['titleTag'] = array(
735 'tab' => 'content',
736 'group' => 'title',
737 'label' => esc_html__( 'Tag', 'bricksable' ),
738 'type' => 'select',
739 'options' => array(
740 'h2' => esc_html__( 'Heading 2 (h2)', 'bricksable' ),
741 'h3' => esc_html__( 'Heading 3 (h3)', 'bricksable' ),
742 'h4' => esc_html__( 'Heading 4 (h4)', 'bricksable' ),
743 'h5' => esc_html__( 'Heading 5 (h5)', 'bricksable' ),
744 'h6' => esc_html__( 'Heading 6 (h6)', 'bricksable' ),
745 ),
746 'inline' => true,
747 'placeholder' => 'span',
748 );
749
750 $this->controls['titleTypography'] = array(
751 'tab' => 'content',
752 'group' => 'title',
753 'label' => esc_html__( 'Typography', 'bricksable' ),
754 'type' => 'typography',
755 'css' => array(
756 array(
757 'property' => 'font',
758 'selector' => '.title',
759 ),
760 ),
761 'inline' => true,
762 'small' => true,
763 );
764
765 /**
766 * Meta
767 */
768
769 $this->controls['metaMargin'] = array(
770 'tab' => 'content',
771 'group' => 'meta',
772 'label' => esc_html__( 'Margin', 'bricksable' ),
773 'type' => 'dimensions',
774 'css' => array(
775 array(
776 'property' => 'margin',
777 'selector' => '.meta',
778 ),
779 ),
780 );
781
782 $this->controls['metaTypography'] = array(
783 'tab' => 'content',
784 'group' => 'meta',
785 'label' => esc_html__( 'Typography', 'bricksable' ),
786 'type' => 'typography',
787 'css' => array(
788 array(
789 'property' => 'font',
790 'selector' => '.meta',
791 ),
792 ),
793 'inline' => true,
794 'small' => true,
795 );
796
797 /**
798 * Description
799 */
800
801 $this->controls['descriptionTypography'] = array(
802 'tab' => 'content',
803 'group' => 'description',
804 'label' => esc_html__( 'Typography', 'bricksable' ),
805 'type' => 'typography',
806 'css' => array(
807 array(
808 'property' => 'font',
809 'selector' => '.description',
810 ),
811 ),
812 'inline' => true,
813 'small' => true,
814 );
815
816 /**
817 * Separator
818 */
819
820 $this->controls['separatorDisable'] = array(
821 'tab' => 'content',
822 'group' => 'separator',
823 'label' => esc_html__( 'Disable', 'bricksable' ),
824 'type' => 'checkbox',
825 'css' => array(
826 array(
827 'property' => 'display',
828 'selector' => '.separator',
829 'value' => 'none',
830 ),
831 ),
832 'default' => true,
833 );
834
835 $this->controls['separatorStyle'] = array(
836 'tab' => 'content',
837 'group' => 'separator',
838 'label' => esc_html__( 'Style', 'bricksable' ),
839 'type' => 'select',
840 'options' => $this->control_options['borderStyle'],
841 'css' => array(
842 array(
843 'property' => 'border-top-style',
844 'selector' => '.separator',
845 ),
846 ),
847 'inline' => true,
848 'required' => array( 'separatorDisable', '=', '' ),
849 );
850
851 $this->controls['separatorWidth'] = array(
852 'tab' => 'content',
853 'group' => 'separator',
854 'label' => esc_html__( 'Width in px', 'bricksable' ),
855 'type' => 'number',
856 'unit' => 'px',
857 'css' => array(
858 array(
859 'property' => 'flex-basis',
860 'selector' => '.separator',
861 ),
862 array(
863 'property' => 'flex-grow',
864 'selector' => '.separator',
865 'value' => '0',
866 ),
867 ),
868 'inline' => true,
869 'required' => array( 'separatorDisable', '=', '' ),
870 );
871
872 $this->controls['separatorHeight'] = array(
873 'tab' => 'content',
874 'group' => 'separator',
875 'label' => esc_html__( 'Height in px', 'bricksable' ),
876 'type' => 'number',
877 'unit' => 'px',
878 'css' => array(
879 array(
880 'property' => 'border-top-width',
881 'selector' => '.separator',
882 ),
883 ),
884 'inline' => true,
885 'required' => array( 'separatorDisable', '=', '' ),
886 );
887
888 $this->controls['separatorColor'] = array(
889 'tab' => 'content',
890 'group' => 'separator',
891 'label' => esc_html__( 'Color', 'bricksable' ),
892 'type' => 'color',
893 'css' => array(
894 array(
895 'property' => 'border-top-color',
896 'selector' => '.separator',
897 ),
898 ),
899 'inline' => true,
900 'small' => true,
901 'required' => array( 'separatorDisable', '=', '' ),
902 );
903
904 }
905
906 public function enqueue_scripts() {
907 wp_enqueue_style( 'ba-icon-list' );
908 }
909
910 public function render() {
911 $settings = $this->settings;
912
913 // Element placeholder.
914 if ( ! isset( $settings['items'] ) || empty( $settings['items'] ) ) {
915 return $this->render_element_placeholder( array( 'text' => esc_html__( 'No list items defined.', 'bricksable' ) ) );
916 }
917
918 $output = '<ul>';
919
920 foreach ( $settings['items'] as $index => $list_item ) {
921 $list_item_classes = array( 'list-item' );
922
923 if ( isset( $list_item['highlight'] ) ) {
924 $list_item_classes[] = 'highlighted';
925 }
926
927 $this->set_attribute( "list-item-$index", 'class', $list_item_classes );
928
929 $output .= '<li ' . $this->render_attributes( "list-item-$index" ) . '>';
930
931 if ( isset( $list_item['highlightLabel'] ) && ! empty( $list_item['highlightLabel'] ) ) {
932 $output .= '<div class="highlight">' . esc_html( $list_item['highlightLabel'] ) . '</div>';
933 }
934
935 $output .= '<div class="content-wrapper">';
936
937 $output .= '<div class="title-wrapper">';
938
939 if ( isset( $list_item['title'] ) && ! empty( $list_item['title'] ) ) {
940 $title_tag = isset( $settings['titleTag'] ) ? esc_attr( $settings['titleTag'] ) : 'span';
941
942 $this->set_attribute( "title-$index", $title_tag );
943 $this->set_attribute( "title-$index", 'class', array( 'title' ) );
944
945 if ( isset( $list_item['link'] ) ) {
946 $this->set_link_attributes( "a-$index", $list_item['link'] );
947 $output .= '<a ' . $this->render_attributes( "a-$index" ) . '>';
948 }
949
950 // Icon.
951 if ( isset( $list_item['icon']['icon'] ) ) {
952 $this->set_attribute(
953 "icon-{$index}",
954 'class',
955 array(
956 'icon',
957 isset( $settings['icon_circle'] ) && null !== $settings['icon_circle'] ? 'ba-icon-list-circle' : '',
958 $list_item['icon']['icon'],
959 )
960 );
961 }
962 $this->set_attribute( "icon-wrapper-$index", 'class', 'icon-wrapper' );
963 $this->set_attribute(
964 "ba-icon-list-icon-$index",
965 'class',
966 array(
967 'ba-icon-list-icon',
968 isset( $settings['icon_circle'] ) && null !== $settings['icon_circle'] ? 'ba-icon-list-circle' : '',
969 )
970 );
971
972 if ( true === isset( $list_item['use_icon_text'] ) ) {
973 if ( isset( $list_item['icon_text'] ) ) {
974 $output .= '<span ' . $this->render_attributes( "icon-wrapper-{$index}" ) . '>'; //phpcs:ignore
975 $output .= '<span ' . $this->render_attributes( "ba-icon-list-icon-{$index}" ) . '>' . esc_html( $list_item['icon_text'] ) . '</span>'; //phpcs:ignore
976 $output .= '</span>';
977 }
978 } elseif ( true === isset( $list_item['use_icon_image'] ) ) {
979 // Image.
980 $image_atts = array();
981 $image_atts['id'] = 'image-' . $list_item['icon_image']['id'];
982 $item_image_classes = array( 'ba-icon-list-icon-image', 'css-filter' );
983 $item_image_classes[] = 'size-' . $list_item['icon_image']['size'];
984 $image_atts['class'] = join( ' ', $item_image_classes );
985 $this->set_attribute( "icon-list-icon-image-{$index}", 'class', $item_image_classes );
986 $this->set_attribute( "icon-list-icon-image-{$index}", 'src', esc_url( $list_item['icon_image']['url'] ) );
987
988 // Lazy load atts set via 'wp_get_attachment_image_attributes' filter.
989 if ( isset( $list_item['icon_image']['id'] ) ) {
990 $output .= wp_get_attachment_image( $list_item['icon_image']['id'], $list_item['icon_image']['size'], false, $image_atts );
991 } elseif ( ! empty( $list_item['icon_image']['url'] ) ) {
992 $output .= '<img ' . $this->render_attributes( "icon-list-icon-image-{$index}" ) . '>'; //phpcs:ignore
993 }
994 } else {
995 if ( isset( $list_item['icon']['icon'] ) ) {
996 $output .= '<span ' . $this->render_attributes( "icon-wrapper-{$index}" ) . '>'; //phpcs:ignore
997 $output .= '<i ' . $this->render_attributes( "icon-{$index}" ) . '></i>'; //phpcs:ignore
998 $output .= '</span>';
999 }
1000 }
1001
1002 $output .= '<' . $this->render_attributes( "title-$index" ) . '>' . $list_item['title'] . '</' . $title_tag . '>';
1003
1004 if ( isset( $list_item['link'] ) ) {
1005 $output .= '</a>';
1006 }
1007 }
1008
1009 if ( ! isset( $list_item['separatorDisable'] ) ) {
1010 $output .= '<span class="separator"></span>';
1011 }
1012
1013 if ( isset( $list_item['meta'] ) && ! empty( $list_item['meta'] ) ) {
1014 $this->set_attribute( "meta-$index", 'class', array( 'meta' ) );
1015
1016 $output .= '<span ' . $this->render_attributes( "meta-$index" ) . '>' . $list_item['meta'] . '</span>';
1017 }
1018
1019 $output .= '</div>';
1020
1021 if ( isset( $list_item['description'] ) && ! empty( $list_item['description'] ) ) {
1022 $this->set_attribute( "description-$index", 'class', array( 'description' ) );
1023
1024 $output .= '<div ' . $this->render_attributes( "description-$index" ) . '>' . $list_item['description'] . '</div>';
1025 }
1026
1027 $output .= '</div>'; // .content-wrapper
1028
1029 $output .= '</li>';
1030 }
1031
1032 $output .= '</ul>';
1033
1034 echo $output; //phpcs:ignore
1035 }
1036
1037 }
1038