]> _ Git - cubist_cms-back.git/commitdiff
#2843
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 20 Jun 2019 13:34:12 +0000 (15:34 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 20 Jun 2019 13:34:12 +0000 (15:34 +0200)
composer.json
src/app/Magic/BunchOfFields.php
src/app/Magic/Models/CMSPage.php

index ee97085cb20f2cb455be7ba31c8c0bf03d138f50..ea26ef5c94408646be286bcae3dec9b9b0e01f9e 100644 (file)
@@ -23,7 +23,6 @@
         "backpack/logmanager": "^2.3",
         "backpack/menucrud": "^1.0",
         "backpack/newscrud": "^2.1",
-        "backpack/pagemanager": "^1.1",
         "backpack/permissionmanager": "^4.0",
         "backpack/settings": "^2.1",
         "backpack/langfilemanager": "^1.0",
index c4992ff023262b7a6927c2d020c01d605f956f41..e042208f07ca80765d51ddde90c28c525dbfce86 100644 (file)
@@ -26,6 +26,12 @@ trait BunchOfFields
         return $field;
     }
 
+    public function addFakeField(array $attributes)
+    {
+        $attributes['fake'] = true;
+        return $this->addField($attributes);
+    }
+
     /**
      * @return Field[]
      */
index 5482ee86c50c4a9b986d6217e497152018070c85..7f60120de078f2da2220b0695acc60248a7dfc39 100644 (file)
@@ -5,6 +5,8 @@ namespace Cubist\Backpack\app\Magic\Models;
 
 class CMSPage extends CubistMagicModel
 {
+    protected static $_templates = [];
+
     protected $table = 'cms_pages';
 
     protected $_options = ['name' => 'page',
@@ -20,7 +22,7 @@ class CMSPage extends CubistMagicModel
             'label' => 'Template',
             'options' => $this->getTemplates(),
             'column' => true,
-            'tab'=>'General',
+            'tab' => 'General',
         ]);
 
         $this->addField(['name' => 'name',
@@ -28,7 +30,7 @@ class CMSPage extends CubistMagicModel
             'type' => 'Text',
             'column' => true,
             'hint' => trans('for admin use'),
-            'tab'=>'General',
+            'tab' => 'General',
         ]);
 
         $this->addField(['name' => 'title',
@@ -40,6 +42,49 @@ class CMSPage extends CubistMagicModel
             'type' => 'Slug',
             'label' => 'Slug (URL)'
         ]);
+
+        $this->_common();
+    }
+
+    protected function _common()
+    {
+        $this->addFakeField([
+            'name' => 'status',
+            'type' => 'SelectFromArray',
+            'default' => '0',
+            'label' => __('Status'),
+            'options' => ['0' => __('Offline'), '1' => __('Published')],
+            'tab' => 'Général',
+        ]);
+        $this->_seo();
+    }
+
+    protected function _seo()
+    {
+        $this->addFakeField([
+            'name' => 'meta_title',
+            'label' => trans('backpack::pagemanager.meta_title'),
+            'type' => 'Text',
+            'hint' => trans('If empty, page title is used.') . ' ' . __('Recommended length: 60 chars'),
+            'tab' => 'Meta // SEO',
+            'store_in'=>'seo',
+        ]);
+        $this->addFakeField([
+            'name' => 'meta_description',
+            'label' => trans('backpack::pagemanager.meta_description'),
+            'type' => 'Textarea',
+            'hint' => __('Recommended length: 160 chars'),
+            'tab' => 'Meta // SEO',
+            'store_in'=>'seo',
+        ]);
+        $this->addFakeField([
+            'name' => 'robots',
+            'label' => __('Allow page index by search engines'),
+            'type' => 'Checkbox',
+            'default' => true,
+            'tab' => 'Meta // SEO',
+            'store_in'=>'seo',
+        ]);
     }
 
     public function getTemplates($template_name = false)