limit categories
This commit is contained in:
+1
-19
@@ -348,10 +348,8 @@ function getDisplayCategories() {
|
||||
$categories = [];
|
||||
$priorityCategories = PRIORITY_CATEGORIES;
|
||||
$allCategories = PEERTUBE_CATEGORIES;
|
||||
|
||||
var_dump($priorityCategories);
|
||||
|
||||
// D'abord ajouter les catégories prioritaires dans l'ordre défini
|
||||
// Ajouter uniquement les catégories prioritaires dans l'ordre défini
|
||||
foreach ($priorityCategories as $catId) {
|
||||
if (isset($allCategories[$catId])) {
|
||||
$videos = getVideosByCategory($catId);
|
||||
@@ -367,22 +365,6 @@ function getDisplayCategories() {
|
||||
}
|
||||
}
|
||||
|
||||
// Ensuite, ajouter les autres catégories qui ont des vidéos
|
||||
foreach ($allCategories as $catId => $catName) {
|
||||
if (!in_array($catId, $priorityCategories)) {
|
||||
$videos = getVideosByCategory($catId);
|
||||
|
||||
// N'ajouter que les catégories qui ont des vidéos
|
||||
if (!empty($videos)) {
|
||||
$categories[] = [
|
||||
'id' => $catId,
|
||||
'name' => $catName,
|
||||
'videos' => $videos
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $categories;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user