Browse Source

Removed the enablePreviewTemplate method from the Admin.
Moved the login to CRUDController and only set the edit template.

Thanos Polymeneas 13 năm trước cách đây
mục cha
commit
4b05f7cb11
2 tập tin đã thay đổi với 2 bổ sung10 xóa
  1. 0 8
      Admin/Admin.php
  2. 2 2
      Controller/CRUDController.php

+ 0 - 8
Admin/Admin.php

@@ -2516,12 +2516,4 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
         return $this->labelTranslatorStrategy;
     }
     
-    /**
-     * Enables the preview template for the create/edit actions
-     */
-    public function enablePreviewTemplate()
-    {
-        $this->setTemplate('edit', $this->getTemplate('preview'));
-        $this->setTemplate('create', $this->getTemplate('preview'));
-    }
 }

+ 2 - 2
Controller/CRUDController.php

@@ -280,7 +280,7 @@ class CRUDController extends Controller
                 $this->get('session')->setFlash('sonata_flash_error', 'flash_edit_error');
             } elseif ($this->isPreviewRequested()) {
                 // enable the preview template if the form was valid and preview was requested
-                $this->admin->enablePreviewTemplate();
+                $this->admin->setTemplate('edit', $this->admin->getTemplate('preview'));
             }
         }
 
@@ -459,7 +459,7 @@ class CRUDController extends Controller
                 $this->get('session')->setFlash('sonata_flash_error', 'flash_create_error');
             } elseif ($this->isPreviewRequested()) {
                 // enable the preview template if the form was valid and preview was requested
-                $this->admin->enablePreviewTemplate();
+                $this->admin->setTemplate('edit', $this->admin->getTemplate('preview'));
             }
         }