aboutsummaryrefslogtreecommitdiffstats
path: root/core/include/post/main.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/include/post/main.php')
-rw-r--r--core/include/post/main.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/include/post/main.php b/core/include/post/main.php
index 86008f6..bfccc7b 100644
--- a/core/include/post/main.php
+++ b/core/include/post/main.php
@@ -2,6 +2,7 @@
#===============================================================================
# Get repositories
#===============================================================================
+$CategoryRepository = Application::getRepository('Category');
$PostRepository = Application::getRepository('Post');
$UserRepository = Application::getRepository('User');
@@ -50,11 +51,27 @@ if($NextPost = $PostRepository->findNext($Post)) {
}
#===============================================================================
+# Generate category template data (including parents)
+#===============================================================================
+foreach($CategoryRepository->findWithParents($Post->get('category')) as $Category) {
+ $category_list[] = generateItemTemplateData($Category);
+}
+
+#===============================================================================
+# Define data variable for current category
+#===============================================================================
+if(isset($category_list)) {
+ $category_data = $category_list[array_key_last($category_list)];
+}
+
+#===============================================================================
# Build document
#===============================================================================
$PostTemplate = Template\Factory::build('post/main');
$PostTemplate->set('POST', $post_data);
$PostTemplate->set('USER', $user_data);
+$PostTemplate->set('CATEGORY', $category_data ?? []);
+$PostTemplate->set('CATEGORIES', $category_list ?? []);
$MainTemplate = Template\Factory::build('main');
$MainTemplate->set('TYPE', 'POST');