From 1ee453dcfe0efdb9e41a7bcf53fa7a64c2376ed3 Mon Sep 17 00:00:00 2001 From: Leonid Nikitin Date: Sat, 25 Jul 2026 23:10:18 +0500 Subject: [PATCH] Add category path support to site documentation views - Introduce `categoryPath` for `DocumentationService` methods. - Resolve category paths dynamically based on parent or category ID. --- .../app/Services/Site/DocumentationService.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/application/app/Services/Site/DocumentationService.php b/app/application/app/Services/Site/DocumentationService.php index 5cbe96f..fa89288 100644 --- a/app/application/app/Services/Site/DocumentationService.php +++ b/app/application/app/Services/Site/DocumentationService.php @@ -77,10 +77,16 @@ final class DocumentationService extends Service return $this->errFobidden(__('Access is denied')); } + $categoryPath = null; + if ($category->parent_id) { + $categoryPath = $this->documentationCategoryRepository->getPathFromRoot($category->parent_id, $documentation->getWebsiteTranslations()->getLanguage()); + } + $data = array_merge($documentation->toArray(), [ 'category' => $category, 'categories' => $this->getCategories($documentation, $category->id), 'documentations' => $this->getDocumentations($documentation, $category->id), + 'categoryPath' => $categoryPath, ]); return $this->resultSitePage($documentation->getProject(), $documentation->getWebsiteTranslations(), $data, \is_null($category->content?->title)); } @@ -98,8 +104,14 @@ final class DocumentationService extends Service return $this->errFobidden(__('Access is denied')); } + $categoryPath = null; + if ($document->category_id) { + $categoryPath = $this->documentationCategoryRepository->getPathFromRoot($document->category_id, $documentation->getWebsiteTranslations()->getLanguage()); + } + $data = array_merge($documentation->toArray(), [ 'documentation' => $document, + 'categoryPath' => $categoryPath, ]); return $this->resultSitePage($documentation->getProject(), $documentation->getWebsiteTranslations(), $data, \is_null($document->content?->title)); }