/** * Seed the form with defaults that are stored in the session * * @param FormBuilder $fb */ public function onBuildForm(FormBuilder $fb) { foreach ($fb->getElements() as $element) { if (!$element instanceof FileElement) { continue; } if (!$fb->getAttribute('enctype') == 'multipart/form-data') { $fb->attr('enctype', 'multipart/form-data'); } } }
public function testGetAttribute() { $this->assertSame('POST', $this->fb->getAttribute('method')); $this->assertNull($this->fb->getAttribute('non-existing')); }