public function addElements() { // File Input $file = new Element\File('file'); $file->setLabel('Multi File'); $fileCollection = new Element\Collection('file-collection'); $fileCollection->setOptions(array('count' => $this->numFileElements, 'allow_add' => false, 'allow_remove' => false, 'target_element' => $file)); $this->add($fileCollection); // Text Input $text = new Element\Text('text'); $text->setLabel('Text Entry'); $this->add($text); }
/** * @group ZF2-336 */ public function testCanAddFileEnctypeFromCollectionAttribute() { $file = new Element\File('file_resource'); $file ->setOptions(array()) ->setLabel('File'); $fileCollection = new Element\Collection('collection'); $fileCollection->setOptions(array( 'count' => 2, 'allow_add' => false, 'allow_remove' => false, 'target_element' => $file, )); $this->form->add($fileCollection); $this->form->prepare(); $enctype = $this->form->getAttribute('enctype'); $this->assertNotEmpty($enctype); $this->assertEquals($enctype, 'multipart/form-data'); }