소스 검색

Removed the debugging comment when not in debug mode

Christophe Coevoet 14 년 전
부모
커밋
2ac9b0c56a
1개의 변경된 파일14개의 추가작업 그리고 7개의 파일을 삭제
  1. 14 7
      Twig/Extension/SonataAdminExtension.php

+ 14 - 7
Twig/Extension/SonataAdminExtension.php

@@ -17,6 +17,10 @@ use Symfony\Component\Form\FormView;
 
 
 class SonataAdminExtension extends \Twig_Extension
 class SonataAdminExtension extends \Twig_Extension
 {
 {
+    /**
+     * @var \Twig_Environment
+     */
+    protected $environment;
 
 
     /**
     /**
      * {@inheritdoc}
      * {@inheritdoc}
@@ -78,12 +82,16 @@ class SonataAdminExtension extends \Twig_Extension
 
 
     public function output(FieldDescriptionInterface $fieldDescription, $content)
     public function output(FieldDescriptionInterface $fieldDescription, $content)
     {
     {
-        return sprintf("\n<!-- START - fieldName: %s, template: %s -->\n%s\n<!-- END - fieldName: %s -->",
-            $fieldDescription->getFieldName(),
-            $fieldDescription->getTemplate(),
-            $content,
-            $fieldDescription->getFieldName()
-        );
+        if ($this->environment->isDebug()) {
+            return sprintf("\n<!-- START - fieldName: %s, template: %s -->\n%s\n<!-- END - fieldName: %s -->",
+                $fieldDescription->getFieldName(),
+                $fieldDescription->getTemplate(),
+                $content,
+                $fieldDescription->getFieldName()
+            );
+        }
+
+        return $content;
     }
     }
 
 
     /**
     /**
@@ -188,4 +196,3 @@ class SonataAdminExtension extends \Twig_Extension
         ))));
         ))));
     }
     }
 }
 }
-