/** * Called after on post-init hook when form is submitted * * @param Form $form Form which was submitted * * @return void */ protected function formSubmit($form) { try { $form->update(); $self = $this; $this->api->addHook('pre-render', function () use($self) { $self->formSubmitSuccess()->execute(); }); } catch (Exception_ValidityCheck $e) { $form->displayError($e->getField(), $e->getMessage()); } }