view - Zend framework 2 loop through elements of element collection -
i created collection of inputs zend\form\element\collection, like
$this->add([ 'type' => 'zend\form\element\collection', 'name' => 'some-name', 'options' => [ 'label' => 'some name', 'count' => 3, 'target_element' => [ 'type' => 'text', ], ], ]);
this codes renders 3 inputs label , fieldset if use
echo $this->formcollection($form->get('some-name'));
(or of formcollection) in view script.
i want wrap each input of collection divs. idea iterate on input collection extract inputs.
how can this?
you can treat collection traversable object.
<?php foreach ($form->get('some-name') $element) : ?> <div>..</div> <?php endforeach; ?>
Comments
Post a Comment