From 044eb7e53242ef4b806700d647e76dc5278fbeec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Mon, 26 Sep 2016 16:54:27 +0200 Subject: [PATCH] FIX: fix order of pages on homepage --- .../Controllers/Admin/Contents/CreateNewContent.php | 2 +- app/Http/Controllers/Admin/Contents/EditContent.php | 2 +- templates/Base/OnePage/Handlers/OnePage.php | 10 +++++++++- templates/DoucovaniNeratovice/Handlers/Handler.php | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Admin/Contents/CreateNewContent.php b/app/Http/Controllers/Admin/Contents/CreateNewContent.php index 61d8d6a4..ef1e9dd8 100644 --- a/app/Http/Controllers/Admin/Contents/CreateNewContent.php +++ b/app/Http/Controllers/Admin/Contents/CreateNewContent.php @@ -76,7 +76,7 @@ class CreateNewContent extends Controller // add categories, if supported $categoryModule = ModuleInstance::get('categories'); $categories = []; - if ($module->support_categories && $categoryModule->enabled()) { + if ($module->support_categories && !is_null($categoryModule) && $categoryModule->enabled()) { $categories = Category::where('module_id', $moduleId) ->get(); } diff --git a/app/Http/Controllers/Admin/Contents/EditContent.php b/app/Http/Controllers/Admin/Contents/EditContent.php index d1cf7a3e..9e5cbe59 100644 --- a/app/Http/Controllers/Admin/Contents/EditContent.php +++ b/app/Http/Controllers/Admin/Contents/EditContent.php @@ -84,7 +84,7 @@ class EditContent extends Controller // add categories, if supported $categories = []; - if ($module->support_categories && $categoryModule->enabled()) { + if ($module->support_categories && !is_null($categoryModule) && $categoryModule->enabled()) { $categories = Category::where('module_id', $module->id) ->get(); } diff --git a/templates/Base/OnePage/Handlers/OnePage.php b/templates/Base/OnePage/Handlers/OnePage.php index 9734aad7..91c4a681 100644 --- a/templates/Base/OnePage/Handlers/OnePage.php +++ b/templates/Base/OnePage/Handlers/OnePage.php @@ -58,7 +58,15 @@ abstract class OnePage implements TemplateHandler $pages = $pages->where('status', Content::STATUS_PUBLIC); } - self:: $homepagePages = $pages->get(); + $homepagePages = $pages->get() + ->getDictionary(); + + foreach ($pageIds as $pageId) { + if (!isset($homepagePages[$pageId])) + continue; + + self::$homepagePages[] = $homepagePages[$pageId]; + } self::$homepagePagesInitialized = true; } diff --git a/templates/DoucovaniNeratovice/Handlers/Handler.php b/templates/DoucovaniNeratovice/Handlers/Handler.php index cf71ba74..d25cb77a 100644 --- a/templates/DoucovaniNeratovice/Handlers/Handler.php +++ b/templates/DoucovaniNeratovice/Handlers/Handler.php @@ -44,6 +44,7 @@ class Handler extends OnePage try { Artisan::call('install-module', ['name' => 'StaticPages']); Artisan::call('install-module', ['name' => 'ContactForm']); + Artisan::call('install-module', ['name' => 'Categories']); } catch (\Exception $e) { // }