]> _ Git - cubist_cms-back.git/commitdiff
#2878
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 11 Jul 2019 14:24:31 +0000 (16:24 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 11 Jul 2019 14:24:31 +0000 (16:24 +0200)
src/app/Http/Controllers/CubistPageController.php
src/app/Magic/PageData.php
src/app/Template/TemplateAbstract.php

index 52fd06beb8ddc283ce03db4753268d8c356bae2e..196a3f1439f88aa20014fce6efa0672b18f701aa 100644 (file)
@@ -13,6 +13,7 @@ class CubistPageController extends CubistFrontController
     public function index($slug = 'home')
     {
         $class = CMSPage::getPageClass();
+        /** @var CMSPage $page */
         $page = $class::findBySlug($slug);
 
         if (!$page) {
@@ -21,6 +22,7 @@ class CubistPageController extends CubistFrontController
 
         $this->data['title'] = $page->title;
         $this->data['page'] = $page->getPageData();
+        $page->getUsedTemplate()->injectDataInView($this->data);
         $this->data['body_class'] = 'page-' . Str::slug($page->name);
 
         return view('pages.' . $page->template, $this->data);
index a590abfd90192c55305652c2819ca688aad23d38..30eee2925381517113284444469dd2c07657fdcd 100644 (file)
@@ -169,7 +169,7 @@ class PageData implements \ArrayAccess
     public function getMedia($offset)
     {
         $collection = $this->getMediaCollection($offset);
-        if (!$collection) {
+        if (!$collection || !is_string($collection)) {
             return [];
         }
         $media = $this->getEntity()->getMedia($collection);
index eaaf9875f5e6cc50ffa44cb06ebd851ac3bdcc6d..5d3096ee864c82024f480fa35bd6adfb7581f583 100644 (file)
@@ -17,7 +17,7 @@ class TemplateAbstract
 
     protected $_fields = [];
 
-    protected $_virtual=false;
+    protected $_virtual = false;
 
     public function __construct()
     {
@@ -129,7 +129,17 @@ class TemplateAbstract
     /**
      * @return bool
      */
-    public function isVirtual(){
+    public function isVirtual()
+    {
         return $this->_virtual;
     }
+
+
+    /**
+     * @param $data array
+     */
+    public function injectDataInView(&$data)
+    {
+
+    }
 }