From fb48bb0cb8990d22f769efdf929dfc2722430c1b Mon Sep 17 00:00:00 2001 From: Volodymyr Shelmuk Date: Wed, 4 Sep 2024 14:35:41 +0300 Subject: [PATCH] feat: support `lang` param for `fau/v1/degree-program/index` endpoint --- .../RestApi/TranslatedDegreeProgramController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Infrastructure/RestApi/TranslatedDegreeProgramController.php b/src/Infrastructure/RestApi/TranslatedDegreeProgramController.php index bdd6d5c..333f593 100644 --- a/src/Infrastructure/RestApi/TranslatedDegreeProgramController.php +++ b/src/Infrastructure/RestApi/TranslatedDegreeProgramController.php @@ -75,6 +75,9 @@ public function register_routes(): void 'methods' => WP_REST_Server::READABLE, 'callback' => [$this, 'getIndex'], 'permission_callback' => [$this, 'get_items_permissions_check'], + 'args' => [ + 'lang' => self::languageParam(), + ], ], ]); register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', [ @@ -190,7 +193,7 @@ public function getIndex(WP_REST_Request $request): WP_Error|WP_REST_Response $views = $this->degreeProgramCollectionRepository->findTranslatedCollection( $criteria, - MultilingualString::DE + $this->requestedLanguage($request) ); if (!$views instanceof PaginationAwareCollection) {