From 4459cb24271d29fecca605097176186a6775d8a8 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 29 Aug 2019 18:43:43 +0200 Subject: [PATCH] fix #2963 @0.5 --- app/Templates/Catalog.php | 8 +++++--- app/Templates/News.php | 5 +++-- app/Templates/Solution.php | 5 +++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/Templates/Catalog.php b/app/Templates/Catalog.php index 52fd70d..4cffafc 100644 --- a/app/Templates/Catalog.php +++ b/app/Templates/Catalog.php @@ -5,7 +5,7 @@ namespace App\Templates; use App\Models\Product; use App\Models\ProductType; -use Cubist\Backpack\app\Magic\Menu\Item; +use Cubist\Backpack\app\Magic\Menu\PageItem; use Cubist\Backpack\app\Magic\Menu\VirtualItem; use Cubist\Backpack\app\Template\TemplateAbstract; use Barryvdh\Debugbar\Facade as Debugbar; @@ -47,7 +47,8 @@ class Catalog extends TemplateAbstract continue; } - $category = new Item(); + $category = new PageItem(); + $category->initFromEntity($productType); $category->setTitle($productType->name); $category->setHref($productType->getSlugOrTitleAttribute()); $category->setId('product_type_' . $productType->id); @@ -61,7 +62,8 @@ class Catalog extends TemplateAbstract if (!$product->online) { continue; } - $detail = new Item(); + $detail = new PageItem(); + $category->initFromEntity($product); $detail->setTitle($product->name); $detail->setHref($product->getSlugOrTitleAttribute()); $detail->setId('product/' . $product->id); diff --git a/app/Templates/News.php b/app/Templates/News.php index a2b8b66..132ba07 100644 --- a/app/Templates/News.php +++ b/app/Templates/News.php @@ -4,7 +4,7 @@ namespace App\Templates; use App\Models\News as NewsModel; use Carbon\Carbon; -use Cubist\Backpack\app\Magic\Menu\Item; +use Cubist\Backpack\app\Magic\Menu\PageItem; use Barryvdh\Debugbar\Facade as Debugbar; class News extends Base @@ -30,7 +30,8 @@ class News extends Base // Todo: see if we should handle events differently? Should events have a different ID + URL and maybe a different controller action in case we need a different layout? - $item = new Item(); + $item = new PageItem(); + $item->initFromEntity($newsItem); $item->setTitle($newsItem->title); $item->setHref($newsItem->slug); // Todo: consider having a configurable / translatable prefix for news URLs $item->setId('news/' . $newsItem->id); diff --git a/app/Templates/Solution.php b/app/Templates/Solution.php index 5b35ffb..7ca9180 100644 --- a/app/Templates/Solution.php +++ b/app/Templates/Solution.php @@ -5,7 +5,7 @@ namespace App\Templates; use App\Models\Application; use Barryvdh\Debugbar\Facade as Debugbar; -use Cubist\Backpack\app\Magic\Menu\Item; +use Cubist\Backpack\app\Magic\Menu\PageItem; use Cubist\Backpack\app\Magic\PageData; class Solution extends Base @@ -45,7 +45,8 @@ class Solution extends Base $applications = Application::all(); foreach ($applications as $application) { - $item = new Item(); + $item = new PageItem(); + $item->initFromEntity($application); $item->setTitle($application->title); $item->setHref($application->getSlugOrTitleAttribute()); $item->setId('application/' . $application->id); -- 2.39.5