/** * @param Field $field * @param array $section */ protected function buildField(Field $field, array $section) { foreach ($section as $key => $data) { if (substr($key, 0, 1) == '@' || $key == 'name') { continue; } if ($key == 'value') { $field->setValue($data); } elseif ($key == 'label') { $field->setLabel($data); } elseif ($key == 'multiple') { $field->setMultiple($data); } elseif ($key == 'filters') { $field->setFilters($data); } elseif ($key == 'options') { $field->setOptions($data); } elseif ($key == 'attributes') { $field->setAttributes($data); } elseif (static::isBaseAttribute($key)) { $field->setAttribute($key, $data); } } }
/** * * @param Field $field * @param string $type {checkbox, option} */ public function __construct(Field $field, $type) { $this->field = $field; $this->options = new ArrayIterator((array) $field->getOptions()); $this->type = $type; }