/** * {@inheritdoc} */ public function val($value = null) { if ($value === null) { return parent::val(); } $this->children = []; $this->valid = null; if ($value) { foreach ($value as $v) { $this->pushVal($v); } } return $this; }
/** * @depends testBase */ public function testValue(Group $field) { $field->val(['name' => 'Oscar', 'email' => '*****@*****.**', 'age' => '35', 'image' => ['name' => '1.png', 'type' => 'image/png', 'tmp_name' => '/tmp/phpTobJ71', 'error' => 0, 'size' => 2297]]); $this->assertCount(4, $field->val()); $this->assertEquals('Oscar', $field['name']->val()); }
/** * {@inheritdoc} */ public function html($html = null) { if ($html !== null) { parent::html($html); } $html = ''; //render the fieldsets not belonging to form foreach ($this->children as $fieldset) { if ($fieldset->getParent() === $this) { $html .= (string) $fieldset; } } //render the fieldsets if (!empty($this->fieldsets)) { foreach ($this->fieldsets as $fieldset) { $html .= (string) $fieldset; } } return $html; }