title: How to pass an argument to a Zend Form Collection instance & How to set custom Fieldset labels in ZF2?
body: <p>I'm trying to understand and get around this whole form collection thing, but the documentation isn't really expansive and I just can't find out how to do some specific things I need.</p>
  
  <p>I will refer to the example in the <a href="http://framework.zend.com/manual/current/en/modules/zend.form.collections.html" rel="nofollow noreferrer">official manual</a> to explain what i need:</p>
  
  <ol>
  <li><p>When the collection is created, you get to use a custom fieldset as target:</p>
  
  <p><code>$this-&gt;add(array(
   'type' =&gt; 'Zend\Form\Element\Collection',
   'name' =&gt; 'categories',
   'options' =&gt; array(
       'label' =&gt; 'Please choose categories for this product',
       'count' =&gt; 2,
       'should_create_template' =&gt; true,
       'template_placeholder' =&gt; '__placeholder_:',
       **'target_element' =&gt; array(
           'type' =&gt; 'Application\Form\CategoryFieldset',
       )**,
   ),
  ));</code></p></li>
  </ol>
  
  <p>However, I need to pass an argument to the specific fieldset's constructor, in my case a translator instance in order to be able to translate within the fieldset.</p>
  
  <p><code>class CategoryFieldset extends Fieldset
  {
       public function __construct($translator)
  }</code></p>
  
  <ol start="2">
  <li>Fieldset's label: as you can see in the example, the collection outputs all the copies of the fieldset with the same specified label "Category". I would need, instead, to have that label numbered, to show "Category 1", "Category 2" etc. based on the collection's count. Is this even possible?
  <a href="https://i.stack.imgur.com/pjwxm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pjwxm.png" alt="Form collection example"></a></li>
  </ol>
  
  <p>Thanks for your help!</p>