public function ajaxForm($form = null) { if (!$form) { $form = new Form\Form(); } elseif (is_array($form)) { $form = new Form\Form($form); } $form['action'] = '/~ajax/'; $form['method'] = 'POST'; $form['ajax'] = true; $form->addField(array('type' => 'hidden', 'name' => '_ajax_infoblock_id', 'value' => $this->getParam('infoblock_id'))); if (isset($_POST['_ajax_base_url'])) { $form->addField(array('type' => 'hidden', 'name' => '_ajax_base_url', 'value' => $_POST['_ajax_base_url'])); } $this->_meta['ajax_access'] = true; return $form; }
public function toForm(\Floxim\Form\Form $form) { foreach ($this->validate_errors as $e) { $form->addError($e['text'], isset($e['field']) ? $e['field'] : false); } }