limit categories
This commit is contained in:
+1
-19
@@ -349,9 +349,7 @@ function getDisplayCategories() {
|
|||||||
$priorityCategories = PRIORITY_CATEGORIES;
|
$priorityCategories = PRIORITY_CATEGORIES;
|
||||||
$allCategories = PEERTUBE_CATEGORIES;
|
$allCategories = PEERTUBE_CATEGORIES;
|
||||||
|
|
||||||
var_dump($priorityCategories);
|
// Ajouter uniquement les catégories prioritaires dans l'ordre défini
|
||||||
|
|
||||||
// D'abord ajouter les catégories prioritaires dans l'ordre défini
|
|
||||||
foreach ($priorityCategories as $catId) {
|
foreach ($priorityCategories as $catId) {
|
||||||
if (isset($allCategories[$catId])) {
|
if (isset($allCategories[$catId])) {
|
||||||
$videos = getVideosByCategory($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;
|
return $categories;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user