1
+ <?php
2
+ declare (strict_types=1 );
3
+
4
+ namespace In2code \Powermail \Tca ;
5
+
6
+ /**
7
+ * Class AddAutocompleteTokens
8
+ * @package In2code\Powermail\Tca
9
+ */
10
+ class AddAutocompleteTokens
11
+ {
12
+ /**
13
+ * @var string
14
+ */
15
+ public static string $ LLL = 'LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:autocomplete_token. ' ;
16
+
17
+ /**
18
+ * @param array $config
19
+ *
20
+ * @return void
21
+ */
22
+ public function getAutocompleteTokens (array &$ config )
23
+ {
24
+ if ($ config ['config ' ]['itemsProcConfig ' ]['useDefaultItems ' ] ?? true ) {
25
+ $ defaultSelectItems = self ::getDefaultAutocompleteTokens ();
26
+ $ config ['items ' ] = array_merge (
27
+ $ config ['items ' ],
28
+ $ defaultSelectItems
29
+ );
30
+ }
31
+ }
32
+
33
+ /**
34
+ * https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field
35
+ * @return array[]
36
+ */
37
+ public static function getDefaultAutocompleteTokens (): array
38
+ {
39
+ return [
40
+ ['label ' => self ::$ LLL . 'name ' , 'value ' => 'name ' , 'icon ' => '' , 'group ' => 'name ' ],
41
+ ['label ' => self ::$ LLL . 'honorific-prefix ' , 'value ' => 'honorific-prefix ' , 'icon ' => '' , 'group ' => 'name ' ],
42
+ ['label ' => self ::$ LLL . 'given-name ' , 'value ' => 'given-name ' , 'icon ' => '' , 'group ' => 'name ' ],
43
+ ['label ' => self ::$ LLL . 'additional-name ' , 'value ' => 'additional-name ' , 'icon ' => '' , 'group ' => 'name ' ],
44
+ ['label ' => self ::$ LLL . 'family-name ' , 'value ' => 'family-name ' , 'icon ' => '' , 'group ' => 'name ' ],
45
+ ['label ' => self ::$ LLL . 'honorific-suffix ' , 'value ' => 'honorific-suffix ' , 'icon ' => '' , 'group ' => 'name ' ],
46
+ ['label ' => self ::$ LLL . 'nickname ' , 'value ' => 'nickname ' , 'icon ' => '' , 'group ' => 'name ' ],
47
+ ['label ' => self ::$ LLL . 'sex ' , 'value ' => 'sex ' , 'icon ' => '' , 'group ' => 'name ' ],
48
+ ['label ' => self ::$ LLL . 'email ' , 'value ' => 'email ' , 'icon ' => '' , 'group ' => 'contact ' ],
49
+ ['label ' => self ::$ LLL . 'impp ' , 'value ' => 'impp ' , 'icon ' => '' , 'group ' => 'contact ' ],
50
+ ['label ' => self ::$ LLL . 'url ' , 'value ' => 'url ' , 'icon ' => '' , 'group ' => 'contact ' ],
51
+ ['label ' => self ::$ LLL . 'organization-title ' , 'value ' => 'organization-title ' , 'icon ' => '' , 'group ' => 'contact ' ],
52
+ ['label ' => self ::$ LLL . 'organization ' , 'value ' => 'organization ' , 'icon ' => '' , 'group ' => 'contact ' ],
53
+ ['label ' => self ::$ LLL . 'street-address ' , 'value ' => 'street-address ' , 'icon ' => '' , 'group ' => 'contact ' ],
54
+ ['label ' => self ::$ LLL . 'country ' , 'value ' => 'country ' , 'icon ' => '' , 'group ' => 'contact ' ],
55
+ ['label ' => self ::$ LLL . 'country-name ' , 'value ' => 'country-name ' , 'icon ' => '' , 'group ' => 'contact ' ],
56
+ ['label ' => self ::$ LLL . 'postal-code ' , 'value ' => 'postal-code ' , 'icon ' => '' , 'group ' => 'contact ' ],
57
+ ['label ' => self ::$ LLL . 'address-line1 ' , 'value ' => 'address-line1 ' , 'icon ' => '' , 'group ' => 'address ' ],
58
+ ['label ' => self ::$ LLL . 'address-line2 ' , 'value ' => 'address-line2 ' , 'icon ' => '' , 'group ' => 'address ' ],
59
+ ['label ' => self ::$ LLL . 'address-line3 ' , 'value ' => 'address-line3 ' , 'icon ' => '' , 'group ' => 'address ' ],
60
+ ['label ' => self ::$ LLL . 'address-level1 ' , 'value ' => 'address-level1 ' , 'icon ' => '' , 'group ' => 'address ' ],
61
+ ['label ' => self ::$ LLL . 'address-level2 ' , 'value ' => 'address-level2 ' , 'icon ' => '' , 'group ' => 'address ' ],
62
+ ['label ' => self ::$ LLL . 'address-level3 ' , 'value ' => 'address-level3 ' , 'icon ' => '' , 'group ' => 'address ' ],
63
+ ['label ' => self ::$ LLL . 'address-level4 ' , 'value ' => 'address-level4 ' , 'icon ' => '' , 'group ' => 'address ' ],
64
+ ['label ' => self ::$ LLL . 'tel ' , 'value ' => 'tel ' , 'icon ' => '' , 'group ' => 'tel ' ],
65
+ ['label ' => self ::$ LLL . 'tel-country-code ' , 'value ' => 'tel-country-code ' , 'icon ' => '' , 'group ' => 'tel ' ],
66
+ ['label ' => self ::$ LLL . 'tel-area-code ' , 'value ' => 'tel-area-code ' , 'icon ' => '' , 'group ' => 'tel ' ],
67
+ ['label ' => self ::$ LLL . 'tel-national ' , 'value ' => 'tel-national ' , 'icon ' => '' , 'group ' => 'tel ' ],
68
+ ['label ' => self ::$ LLL . 'tel-local ' , 'value ' => 'tel-local ' , 'icon ' => '' , 'group ' => 'tel ' ],
69
+ ['label ' => self ::$ LLL . 'tel-local-prefix ' , 'value ' => 'tel-local-prefix ' , 'icon ' => '' , 'group ' => 'tel ' ],
70
+ ['label ' => self ::$ LLL . 'tel-local-suffix ' , 'value ' => 'tel-local-suffix ' , 'icon ' => '' , 'group ' => 'tel ' ],
71
+ ['label ' => self ::$ LLL . 'tel-extension ' , 'value ' => 'tel-extension ' , 'icon ' => '' , 'group ' => 'tel ' ],
72
+ ['label ' => self ::$ LLL . 'username ' , 'value ' => 'username ' , 'icon ' => '' , 'group ' => 'user ' ],
73
+ ['label ' => self ::$ LLL . 'new-password ' , 'value ' => 'new-password ' , 'icon ' => '' , 'group ' => 'user ' ],
74
+ ['label ' => self ::$ LLL . 'current-password ' , 'value ' => 'current-password ' , 'icon ' => '' , 'group ' => 'user ' ],
75
+ ['label ' => self ::$ LLL . 'one-time-code ' , 'value ' => 'one-time-code ' , 'icon ' => '' , 'group ' => 'user ' ],
76
+ ['label ' => self ::$ LLL . 'bday ' , 'value ' => 'bday ' , 'icon ' => '' , 'group ' => 'bday ' ],
77
+ ['label ' => self ::$ LLL . 'bday-day ' , 'value ' => 'bday-day ' , 'icon ' => '' , 'group ' => 'bday ' ],
78
+ ['label ' => self ::$ LLL . 'bday-month ' , 'value ' => 'bday-month ' , 'icon ' => '' , 'group ' => 'bday ' ],
79
+ ['label ' => self ::$ LLL . 'bday-year ' , 'value ' => 'bday-year ' , 'icon ' => '' , 'group ' => 'bday ' ],
80
+ ['label ' => self ::$ LLL . 'cc-name ' , 'value ' => 'cc-name ' , 'icon ' => '' , 'group ' => 'cc ' ],
81
+ ['label ' => self ::$ LLL . 'cc-given-name ' , 'value ' => 'cc-given-name ' , 'icon ' => '' , 'group ' => 'cc ' ],
82
+ ['label ' => self ::$ LLL . 'cc-additional-name ' , 'value ' => 'cc-additional-name ' , 'icon ' => '' , 'group ' => 'cc ' ],
83
+ ['label ' => self ::$ LLL . 'cc-family-name ' , 'value ' => 'cc-family-name ' , 'icon ' => '' , 'group ' => 'cc ' ],
84
+ ['label ' => self ::$ LLL . 'cc-number ' , 'value ' => 'cc-number ' , 'icon ' => '' , 'group ' => 'cc ' ],
85
+ ['label ' => self ::$ LLL . 'cc-exp ' , 'value ' => 'cc-exp ' , 'icon ' => '' , 'group ' => 'cc ' ],
86
+ ['label ' => self ::$ LLL . 'cc-exp-month ' , 'value ' => 'cc-exp-month ' , 'icon ' => '' , 'group ' => 'cc ' ],
87
+ ['label ' => self ::$ LLL . 'cc-exp-year ' , 'value ' => 'cc-exp-year ' , 'icon ' => '' , 'group ' => 'cc ' ],
88
+ ['label ' => self ::$ LLL . 'cc-csc ' , 'value ' => 'cc-csc ' , 'icon ' => '' , 'group ' => 'cc ' ],
89
+ ['label ' => self ::$ LLL . 'cc-type ' , 'value ' => 'cc-type ' , 'icon ' => '' , 'group ' => 'cc ' ],
90
+ ['label ' => self ::$ LLL . 'transaction-currency ' , 'value ' => 'transaction-currency ' , 'icon ' => '' , 'group ' => 'cc ' ],
91
+ ['label ' => self ::$ LLL . 'transaction-amount ' , 'value ' => 'transaction-amount ' , 'icon ' => '' , 'group ' => 'cc ' ],
92
+ ['label ' => self ::$ LLL . 'language ' , 'value ' => 'language ' , 'icon ' => '' , 'group ' => 'other ' ],
93
+ ['label ' => self ::$ LLL . 'photo ' , 'value ' => 'photo ' , 'icon ' => '' , 'group ' => 'other ' ],
94
+ ];
95
+ }
96
+ }
0 commit comments