瀏覽代碼

added the possibility to easily customize the template of just one widget of a form

Fabien Potencier 14 年之前
父節點
當前提交
a204aec08b
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/Symfony/Bridge/Twig/Extension/FormExtension.php

+ 3 - 0
src/Symfony/Bridge/Twig/Extension/FormExtension.php

@@ -156,6 +156,9 @@ class FormExtension extends \Twig_Extension
     {
         $templates = $this->getTemplates($view);
         $blocks = $view->get('types');
+        if ('widget' === $section || 'row' === $section) {
+            array_unshift($blocks, '_'.$view->get('id'));
+        }
         foreach ($blocks as &$block) {
             $block = $block.'_'.$section;