diff --git a/tools/bazar/controllers/ApiController.php b/tools/bazar/controllers/ApiController.php index 55e4e424d..820662f61 100644 --- a/tools/bazar/controllers/ApiController.php +++ b/tools/bazar/controllers/ApiController.php @@ -306,24 +306,26 @@ public function getBazarListData() return $entry['id_typeannonce']; }, $entries); $formIds = array_unique($formIds); + $usedForms = array_filter($forms, function ($form) use ($formIds) { + return in_array($form['bn_id_nature'], $formIds); + }); + $usedForms = array_map(function ($f) { + return $f['prepared']; + }, $usedForms); // Reduce the size of the data sent by transforming entries object into array // we use the $fieldMapping to transform back the data when receiving data in the front end $entries = array_map(function ($entry) use ($fieldList) { $result = []; foreach ($fieldList as $field) { + if (!empty($entry[$field]) && !empty($_GET['displayfields']['subtitle']) && $_GET['displayfields']['subtitle'] == $field) { + $entry[$field] = $this->wiki->Format($entry[$field]); + } $result[] = $entry[$field] ?? null; } - return $result; }, $entries); - $usedForms = array_filter($forms, function ($form) use ($formIds) { - return in_array($form['bn_id_nature'], $formIds); - }); - $usedForms = array_map(function ($f) { - return $f['prepared']; - }, $usedForms); return new ApiResponse( [