@@ -213,6 +213,8 @@ public function addMetadata($doc, $entityNode, $entity)
213
213
214
214
// add controlled vocabularies
215
215
// get the supported locale keys
216
+ # f11557
217
+ # TODO native XML
216
218
$ controlledVocabulariesMapping = $ this ->_getControlledVocabulariesMappings ();
217
219
foreach ($ controlledVocabulariesMapping as $ controlledVocabulariesNodeName => $ mappings ) {
218
220
$ symbolic = $ mappings [0 ];
@@ -239,12 +241,22 @@ public function addControlledVocabulary($doc, $entityNode, $controlledVocabulari
239
241
{
240
242
$ deployment = $ this ->getDeployment ();
241
243
$ locales = array_keys ($ controlledVocabulary );
244
+
242
245
foreach ($ locales as $ locale ) {
243
246
if (!empty ($ controlledVocabulary [$ locale ])) {
244
247
$ controlledVocabulariesNode = $ doc ->createElementNS ($ deployment ->getNamespace (), $ controlledVocabulariesNodeName );
245
248
$ controlledVocabulariesNode ->setAttribute ('locale ' , $ locale );
246
- foreach ($ controlledVocabulary [$ locale ] as $ controlledVocabularyItem ) {
247
- $ controlledVocabulariesNode ->appendChild ($ node = $ doc ->createElementNS ($ deployment ->getNamespace (), $ controlledVocabularyNodeName , htmlspecialchars ($ controlledVocabularyItem , ENT_COMPAT , 'UTF-8 ' )));
249
+
250
+ foreach ($ controlledVocabulary [$ locale ] as $ item ) {
251
+ $ node = $ doc ->createElementNS ($ deployment ->getNamespace (), $ controlledVocabularyNodeName );
252
+ $ node ->appendChild ($ doc ->createElementNS ($ deployment ->getNamespace (), 'name ' , htmlspecialchars ($ item ['name ' ], ENT_COMPAT , 'UTF-8 ' )));
253
+ if (!empty ($ item ['identifier ' ])) {
254
+ $ node ->appendChild ($ doc ->createElementNS ($ deployment ->getNamespace (), 'identifier ' , htmlspecialchars ($ item ['identifier ' ], ENT_COMPAT , 'UTF-8 ' )));
255
+ }
256
+ if (!empty ($ item ['source ' ])) {
257
+ $ node ->appendChild ($ doc ->createElementNS ($ deployment ->getNamespace (), 'source ' , htmlspecialchars ($ item ['source ' ], ENT_COMPAT , 'UTF-8 ' )));
258
+ }
259
+ $ controlledVocabulariesNode ->appendChild ($ node );
248
260
}
249
261
250
262
$ entityNode ->appendChild ($ controlledVocabulariesNode );
0 commit comments