@@ -83,8 +83,8 @@ public function Field($properties = [])
83
83
Requirements::javascript ('symbiote/silverstripe-multivaluefield: client/dist/js/multivaluefield.js ' );
84
84
Requirements::css ('symbiote/silverstripe-multivaluefield: client/dist/styles/multivaluefield.css ' );
85
85
86
- $ nameKey = $ this ->name . '[key][] ' ;
87
- $ nameVal = $ this ->name . '[val][] ' ;
86
+ $ nameKey = $ this ->name . '[key][] ' ;
87
+ $ nameVal = $ this ->name . '[val][] ' ;
88
88
$ fields = [];
89
89
$ keyFieldPlaceholder = $ this ->getKeyFieldPlaceholder ();
90
90
$ valueFieldPlaceholder = $ this ->getValueFieldPlaceholder ();
@@ -93,20 +93,20 @@ public function Field($properties = [])
93
93
foreach ($ this ->value as $ i => $ v ) {
94
94
if ($ this ->readonly ) {
95
95
$ fieldAttr = [
96
- 'class ' => 'mventryfield mvkeyvalReadonly ' . ($ this ->extraClass () ? $ this ->extraClass () : '' ),
97
- 'id ' => $ this ->id (). MultiValueTextField::KEY_SEP . $ i ,
96
+ 'class ' => 'mventryfield mvkeyvalReadonly ' . ($ this ->extraClass () ? $ this ->extraClass () : '' ),
97
+ 'id ' => $ this ->id () . MultiValueTextField::KEY_SEP . $ i ,
98
98
'name ' => $ nameKey ,
99
99
'tabindex ' => $ this ->getAttribute ('tabindex ' )
100
100
];
101
101
102
102
$ keyField = HTML ::createTag ('span ' , $ fieldAttr , Convert::raw2xml ($ i ));
103
- $ fieldAttr ['id ' ] = $ this ->id (). MultiValueTextField::KEY_SEP . $ v ;
103
+ $ fieldAttr ['id ' ] = $ this ->id () . MultiValueTextField::KEY_SEP . $ v ;
104
104
$ valField = HTML ::createTag ('span ' , $ fieldAttr , Convert::raw2xml ($ v ));
105
- $ fields [] = $ keyField. $ valField ;
105
+ $ fields [] = $ keyField . $ valField ;
106
106
} else {
107
107
$ keyField = $ this ->createSelectList ($ i , $ nameKey , $ this ->sourceKeys , $ i , $ keyFieldPlaceholder );
108
108
$ valField = $ this ->createSelectList ($ i , $ nameVal , $ this ->sourceValues , $ v , $ valueFieldPlaceholder );
109
- $ fields [] = $ keyField. ' ' . $ valField ;
109
+ $ fields [] = $ keyField . ' ' . $ valField ;
110
110
}
111
111
}
112
112
} else {
@@ -116,14 +116,12 @@ public function Field($properties = [])
116
116
if (!$ this ->readonly ) {
117
117
$ keyField = $ this ->createSelectList ('new ' , $ nameKey , $ this ->sourceKeys , '' , $ keyFieldPlaceholder );
118
118
$ valField = $ this ->createSelectList ('new ' , $ nameVal , $ this ->sourceValues , '' , $ valueFieldPlaceholder );
119
- $ fields [] = $ keyField. ' ' . $ valField ;
120
- // $fields[] = $this->createSelectList('new', $name, $this->source);
119
+ $ fields [] = $ keyField . ' ' . $ valField ;
120
+ // $fields[] = $this->createSelectList('new', $name, $this->source);
121
121
}
122
122
123
- return '<ul id=" ' .$ this ->id ().'" class="multivaluefieldlist mvkeyvallist ' .$ this ->extraClass ().'"><li> ' .implode (
124
- '</li><li> ' ,
125
- $ fields
126
- ).'</li></ul> ' ;
123
+ return '<ul id=" ' . $ this ->id () . '" class="multivaluefieldlist mvkeyvallist ' . $ this ->extraClass () . '"><li> '
124
+ . implode ('</li><li> ' , $ fields ) . '</li></ul> ' ;
127
125
}
128
126
129
127
protected function createSelectList ($ number , $ name , $ values , $ selected = '' , $ placeholder = '' )
@@ -133,7 +131,7 @@ protected function createSelectList($number, $name, $values, $selected = '', $pl
133
131
[
134
132
'selected ' => $ selected == '' ? 'selected ' : '' ,
135
133
'value ' => ''
136
- ],
134
+ ],
137
135
''
138
136
);
139
137
@@ -147,8 +145,8 @@ protected function createSelectList($number, $name, $values, $selected = '', $pl
147
145
148
146
if (count ($ values ?? [])) {
149
147
$ attrs = [
150
- 'class ' => 'text mventryfield mvdropdown ' . ($ this ->extraClass () ? $ this ->extraClass () : '' ),
151
- 'id ' => $ this ->id (). MultiValueTextField::KEY_SEP . $ number ,
148
+ 'class ' => 'text mventryfield mvdropdown ' . ($ this ->extraClass () ? $ this ->extraClass () : '' ),
149
+ 'id ' => $ this ->id () . MultiValueTextField::KEY_SEP . $ number ,
152
150
'name ' => $ name ,
153
151
'tabindex ' => $ this ->getAttribute ('tabindex ' )
154
152
];
@@ -160,8 +158,8 @@ protected function createSelectList($number, $name, $values, $selected = '', $pl
160
158
return HTML ::createTag ('select ' , $ attrs , $ options );
161
159
} else {
162
160
$ attrs = [
163
- 'class ' => 'text mventryfield mvtextfield ' . ($ this ->extraClass () ? $ this ->extraClass () : '' ),
164
- 'id ' => $ this ->id (). MultiValueTextField::KEY_SEP . $ number ,
161
+ 'class ' => 'text mventryfield mvtextfield ' . ($ this ->extraClass () ? $ this ->extraClass () : '' ),
162
+ 'id ' => $ this ->id () . MultiValueTextField::KEY_SEP . $ number ,
165
163
'value ' => $ selected ,
166
164
'name ' => $ name ,
167
165
'tabindex ' => $ this ->getAttribute ('tabindex ' ),
0 commit comments