<p dir="auto">Hey!</p>
<p dir="auto">While trying to fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="135071026" data-permission-text="Title is private" data-url="https://github.com/egeloen/IvoryCKEditorBundle/issues/212" data-hovercard-type="issue" data-hovercard-url="/egeloen/IvoryCKEditorBundle/issues/212/hovercard" href="https://github.com/egeloen/IvoryCKEditorBundle/issues/212">egeloen/IvoryCKEditorBundle#212</a> I have added a <code class="notranslate">form_javascript</code> Twig functions which allows to render form javascript related code where you want in the template.</p>
<p dir="auto">Doing so, allow to link javascript code to a specific form type, allow to render your javascript where you want in the page (often at the bottom of the page), allow to take benefit of the form theming inheritance (for example: form -&gt; text -&gt; textarea) and also define a standard way of linking javascript code to a form.</p>
<p dir="auto">I have decided to open the issue because my implementation is not new, it has been inspired by <a href="https://github.com/genemu/GenemuFormBundle">GenemuFormBundle</a> and <a href="https://github.com/stephanecollot/DatetimepickerBundle">DatetimepickerBundle</a> which both rely on the exact same concept and the exact same code is duplicated along different bundles...</p>
<p dir="auto">Now my question is does it belong to the core or to a third party library? WDYT?</p>
<p dir="auto">I have a page that looks like:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="_______________
Action block
Ignore / Reject / ....
_______________

all data
table &gt; tr &gt; td * N

_______________
Action block
Ignore / Reject / ....
_______________"><pre class="notranslate"><code class="notranslate">_______________
Action block
Ignore / Reject / ....
_______________

all data
table &gt; tr &gt; td * N

_______________
Action block
Ignore / Reject / ....
_______________
</code></pre></div>
<p dir="auto">As you can see, I have the same "action block" on my page.<br>
All buttons are symfony form. and Right now I'm not able to display the same form twice.<br>
I can use "hacky" code like that:</p>
<div class="highlight highlight-text-html-django notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{# this is a hack, this block in not in the main stream #}
{% block actions %}
    &lt;div class=&quot;panel panel-default&quot;&gt;
        &lt;div class=&quot;panel-heading&quot;&gt;Actions&lt;/div&gt;
        &lt;div class=&quot;panel-body&quot;&gt;
            {{ form(form_actions)}}
        &lt;/div&gt;
    &lt;/div&gt;
{% endblock %}

{% set actions = block('actions') %}

{% block body %}
    {{ actions|raw }}
    table 
    {{ actions|raw }}
{% endblock %}"><pre class="notranslate"><span class="pl-c">{# this is a hack, this block in not in the main stream #}</span>
<span class="pl-e">{%</span> <span class="pl-k">block</span> <span class="pl-s">actions</span> <span class="pl-e">%}</span>
    &lt;<span class="pl-ent">div</span> <span class="pl-e">class</span>=<span class="pl-s"><span class="pl-pds">"</span>panel panel-default<span class="pl-pds">"</span></span>&gt;
        &lt;<span class="pl-ent">div</span> <span class="pl-e">class</span>=<span class="pl-s"><span class="pl-pds">"</span>panel-heading<span class="pl-pds">"</span></span>&gt;Actions&lt;/<span class="pl-ent">div</span>&gt;
        &lt;<span class="pl-ent">div</span> <span class="pl-e">class</span>=<span class="pl-s"><span class="pl-pds">"</span>panel-body<span class="pl-pds">"</span></span>&gt;
            {{ form(form_actions)}}
        &lt;/<span class="pl-ent">div</span>&gt;
    &lt;/<span class="pl-ent">div</span>&gt;
<span class="pl-e">{%</span> <span class="pl-k">endblock</span> <span class="pl-e">%}</span>

<span class="pl-e">{%</span> <span class="pl-s">set</span> <span class="pl-s">actions</span> = <span class="pl-k">block</span>(<span class="pl-s">'actions'</span>) <span class="pl-e">%}</span>

<span class="pl-e">{%</span> <span class="pl-k">block</span> <span class="pl-s">body</span> <span class="pl-e">%}</span>
    {{ actions|raw }}
    table 
    {{ actions|raw }}
<span class="pl-e">{%</span> <span class="pl-k">endblock</span> <span class="pl-e">%}</span></pre></div>
<p dir="auto">But I don't like it.</p>
<p dir="auto">May be I should not use SF form to handle that, But I need CSRF protection. And now, the way to handle CSRF check in a controller, is not so easy.</p>
<p dir="auto">(PS: I see this issue was rejected in the past, but I have a different use case here).</p>