Explorar el Código

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

Thanos Polymeneas hace 13 años
padre
commit
ce6f77154e
Se han modificado 2 ficheros con 17 adiciones y 2 borrados
  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());
     }
 
     /**