title: Symfony 4: pass custom data to Form Collection prototype
body: <p>CollectionType field has special 'prototype' variable when 'allow_add' option is set to true. This variable can be used to render prototype html like this:</p>
  
  <pre><code>data-prototype="{{ form_widget(form.collectionfieldname.vars.prototype)|e('html_attr') }}"
  </code></pre>
  
  <p>It looks like 'prototype' is simply an instance of collection children FormView built with partial data (e.g. name is set to "__name__" while most other vars are left blank).</p>
  
  <p>Where all this magic happens? Is it possible to modify what data is passed to prototype view while building form? For example, I would like to change default value of "value" variable from blank to "__val__" (outside of Twig template).</p>