protected function afterInit() { parent::afterInit(); $this->form = factory::get('form_db', array_merge($this->cfg->formOpts, array('table' => $this->cfg->table))); $this->replaceName = str_replace('[]', '', $this->name) . '_fields[' . $this->cfg->replaceKey . '][[name]]'; foreach ($this->cfg->fields as $f) { $f['name'] = str_replace('[name]', $f['name'], $this->replaceName); $this->form->addFromField($f); } $this->prepareValuesForValid(); $this->valid->getCfg()->setRef('value', $this->valuesForValid); }