From 7df8667a0995f1919a8408e27cc0b88021e5cac8 Mon Sep 17 00:00:00 2001 From: Abraham Date: Fri, 20 Feb 2026 15:48:19 +0100 Subject: [PATCH 1/2] Blog detail separate page --- src/Backend/Modules/Blog/Installer/Installer.php | 1 + src/Frontend/Modules/Blog/Actions/Detail.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Backend/Modules/Blog/Installer/Installer.php b/src/Backend/Modules/Blog/Installer/Installer.php index 86305b6a47..6c282afaf1 100644 --- a/src/Backend/Modules/Blog/Installer/Installer.php +++ b/src/Backend/Modules/Blog/Installer/Installer.php @@ -101,6 +101,7 @@ private function configureBackendWidgets(): void private function configureFrontendExtras(): void { $this->blogBlockId = $this->insertExtra($this->getModule(), ModuleExtraType::block(), 'Blog'); + $this->insertExtra($this->getModule(), ModuleExtraType::block(), 'Detail', 'Detail'); $this->insertExtra($this->getModule(), ModuleExtraType::widget(), 'Archive', 'Archive'); $this->insertExtra($this->getModule(), ModuleExtraType::widget(), 'Categories', 'Categories'); $this->insertExtra($this->getModule(), ModuleExtraType::widget(), 'RecentArticlesFull', 'RecentArticlesFull'); diff --git a/src/Frontend/Modules/Blog/Actions/Detail.php b/src/Frontend/Modules/Blog/Actions/Detail.php index ac6e7cc617..f8d8711b41 100644 --- a/src/Frontend/Modules/Blog/Actions/Detail.php +++ b/src/Frontend/Modules/Blog/Actions/Detail.php @@ -65,17 +65,17 @@ protected function setMeta(Meta $meta): void private function getBlogPost(): array { - if ($this->url->getParameter(1) === null) { + if ($this->url->getParameter(0) === null) { throw new NotFoundHttpException(); } if ($this->url->getParameter('revision', 'int') === null) { - return $this->completeBlogPost(FrontendBlogModel::get($this->url->getParameter(1))); + return $this->completeBlogPost(FrontendBlogModel::get($this->url->getParameter(0))); } return $this->completeBlogPost( FrontendBlogModel::getRevision( - $this->url->getParameter(1), + $this->url->getParameter(0), $this->url->getParameter('revision', 'int') ) ); From 16525846cf177dfbe862afb475d5bf912fa86848 Mon Sep 17 00:00:00 2001 From: Abraham Date: Mon, 23 Feb 2026 10:34:50 +0100 Subject: [PATCH 2/2] Add blog detail page with example data --- .../Modules/Blog/Installer/Data/locale.xml | 9 +++++++++ .../Modules/Blog/Installer/Installer.php | 20 ++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/Backend/Modules/Blog/Installer/Data/locale.xml b/src/Backend/Modules/Blog/Installer/Data/locale.xml index e703f0cf54..87bb56c517 100644 --- a/src/Backend/Modules/Blog/Installer/Data/locale.xml +++ b/src/Backend/Modules/Blog/Installer/Data/locale.xml @@ -435,6 +435,15 @@ + + + + + + + + + diff --git a/src/Backend/Modules/Blog/Installer/Installer.php b/src/Backend/Modules/Blog/Installer/Installer.php index 6c282afaf1..e85361ab9e 100644 --- a/src/Backend/Modules/Blog/Installer/Installer.php +++ b/src/Backend/Modules/Blog/Installer/Installer.php @@ -17,6 +17,9 @@ class Installer extends ModuleInstaller /** @var int */ private $blogBlockId; + /** @var int */ + private $blogBlockDetailId; + public function install(): void { $this->addModule('Blog'); @@ -101,7 +104,7 @@ private function configureBackendWidgets(): void private function configureFrontendExtras(): void { $this->blogBlockId = $this->insertExtra($this->getModule(), ModuleExtraType::block(), 'Blog'); - $this->insertExtra($this->getModule(), ModuleExtraType::block(), 'Detail', 'Detail'); + $this->blogBlockDetailId = $this->insertExtra($this->getModule(), ModuleExtraType::block(), 'Detail', 'Detail'); $this->insertExtra($this->getModule(), ModuleExtraType::widget(), 'Archive', 'Archive'); $this->insertExtra($this->getModule(), ModuleExtraType::widget(), 'Categories', 'Categories'); $this->insertExtra($this->getModule(), ModuleExtraType::widget(), 'RecentArticlesFull', 'RecentArticlesFull'); @@ -132,13 +135,20 @@ private function configureFrontendPages(): void $this->setSetting($this->getModule(), 'rss_description_' . $language, ''); // check if a page for blog already exists in this language - if (!$this->hasPageWithBlogBlock($language)) { - $this->insertPage( + if (!$this->hasPageWithBlogBlock($language, $this->blogBlockId)) { + $indexId = $this->insertPage( ['title' => 'Blog', 'language' => $language], null, ['extra_id' => $this->blogBlockId, 'position' => 'main'], ['extra_id' => $searchId, 'position' => 'top'] ); + if (!$this->hasPageWithBlogBlock($language, $this->blogBlockDetailId)) { + $this->insertPage( + ['title' => 'Detail', 'language' => $language, 'parent_id' => $indexId], + null, + ['extra_id' => $this->blogBlockDetailId, 'position' => 'main'], + ); + } } if ($this->installExample()) { @@ -183,7 +193,7 @@ private function getSearchWidgetId(): int ); } - private function hasPageWithBlogBlock(string $language): bool + private function hasPageWithBlogBlock(string $language, int $blockId): bool { // @todo: Replace with a PageRepository method when it exists. return (bool) $this->getDatabase()->getVar( @@ -192,7 +202,7 @@ private function hasPageWithBlogBlock(string $language): bool INNER JOIN pages_blocks AS b ON b.revision_id = p.revision_id WHERE b.extra_id = ? AND p.language = ? LIMIT 1', - [$this->blogBlockId, $language] + [$blockId, $language] ); }