diff --git a/src/plugin/cursus/Controller/CourseController.php b/src/plugin/cursus/Controller/CourseController.php index 4325387094..be30ba59c7 100644 --- a/src/plugin/cursus/Controller/CourseController.php +++ b/src/plugin/cursus/Controller/CourseController.php @@ -104,6 +104,8 @@ protected function getDefaultHiddenFilters(): array if (!$this->checkToolAccess('EDIT')) { $filters['hidden'] = false; } + + $filters['archived'] = false; } return $filters; @@ -115,9 +117,7 @@ protected function getDefaultHiddenFilters(): array public function listAction(Request $request): JsonResponse { $params = $request->query->all(); - $params['hiddenFilters'] = [ - 'archived' => false, - ]; + $params['hiddenFilters'] = array_merge($this->getDefaultHiddenFilters(), $params['hiddenFilters'] ?? []); return new JsonResponse( $this->crud->list(Course::class, $params) @@ -129,16 +129,16 @@ public function listAction(Request $request): JsonResponse */ public function listPublicAction(Request $request): JsonResponse { - $params = $request->query->all(); - $params['hiddenFilters'] = [ - 'public' => true, - ]; - - return new JsonResponse( - $this->crud->list(Course::class, $params) - ); + return new JsonResponse($this->crud->list( + Course::class, + array_merge($request->query->all(), ['hiddenFilters' => array_merge($this->getDefaultHiddenFilters(), [ + 'public' => true, + ])]), + $this->getOptions()['list'] + )); } + /** * @Route("/list/archived", name="apiv2_cursus_course_list_archived", methods={"GET"}) */