ソースを参照

Readded the supports preview mode getter and added another check for its value when determining preview mode

Thanos Polymeneas 13 年 前
コミット
ce6f77154e
2 ファイル変更17 行追加2 行削除
  1. 13 1
      Admin/Admin.php
  2. 4 1
      Controller/CRUDController.php

+ 13 - 1
Admin/Admin.php

@@ -396,7 +396,7 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
      * 
      * @var boolean	
      */
-    public $supportsPreviewMode = false;
+    protected $supportsPreviewMode = false;
 
     /**
      * Roles and permissions per role
@@ -2516,4 +2516,16 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
         return $this->labelTranslatorStrategy;
     }
     
+	/**
+     * Returning true will enable preview mode for
+     * the target entity and show a preview button
+     * when editing/creating an entity
+     * 
+     * @return boolean
+     */
+    public function supportsPreviewMode()
+    {
+        return $this->supportsPreviewMode;
+    }
+    
 }

+ 4 - 1
Controller/CRUDController.php

@@ -505,7 +505,10 @@ class CRUDController extends Controller
      */
     protected function isInPreviewMode()
     {
-        return ($this->isPreviewRequested() || $this->isPreviewApproved() || $this->isPreviewDeclined());
+        return $this->admin->supportsPreviewMode()
+            && ($this->isPreviewRequested()
+                || $this->isPreviewApproved()
+                || $this->isPreviewDeclined());
     }
 
     /**