title: Symfony 2 & Twig, how to access block from extension
body: <p>I'm creating my Twig Extension to extend the actual "FormExtension".
  Reason for that is that I need to create new functions without overwriting the current ones and making this available across my entire project.</p>
  
  <p>So building and extension seemed to be the right way to go.
  Building the extension is not a problem, my problem is how to render block from there?</p>
  
  <p>What I understood till here, is that I need to create a Twig_Environment where I have to load my actual twig template (containing my blocks).
  From there I should be able to render those block using "$mytemplate->displayBlock()".</p>
  
  <p>Sample code:</p>
  
  <blockquote>
    <p>public function renderWidgetinline(FormView $view, array $variables = array())
       {</p>
  
  <pre><code>  $loader = new \Twig_Loader_Filesystem(__DIR__.'/../Resources/views/Form');
    $twig = new \Twig_Environment($loader);
    $this-&gt;template = $twig-&gt;loadTemplate("form_layout.html.twig");
  
    ob_start();
    $this-&gt;template-&gt;displayBlock(???WHAT-PARAMS???);
    $html = ob_get_clean();
  
    return $html;
  </code></pre>
    
    <p>}</p>
  </blockquote>
  
  <p>I found those information by looking at the Symfony base FormExtension.php file.</p>
  
  <p>My questions are:</p>
  
  <ol>
  <li>How does displayBlock() works, where can I found the defintion of that function?</li>
  <li>Is what I described above the right way to go?</li>
  <li>How should I proceed to have access to that new TWIG template together with the base form_div_layout.html template? Can I somehow get the current environment without having to recreated one and load my additional template there?</li>
  </ol>
  
  <p>Thanks!</p>