/** * Validate the form */ private function validateForm() { if ($this->frm->isSubmitted()) { $this->meta->setURLCallback('Backend\\Modules\\Agenda\\Engine\\Model', 'getURLForCategory'); $this->frm->cleanupFields(); // validate fields $this->frm->getField('title')->isFilled(BL::err('TitleIsRequired')); // validate meta $this->meta->validate(); if ($this->frm->isCorrect()) { // build item $item['title'] = $this->frm->getField('title')->getValue(); $item['language'] = BL::getWorkingLanguage(); $item['meta_id'] = $this->meta->save(); $item['sequence'] = BackendAgendaModel::getMaximumCategorySequence() + 1; // save the data $item['id'] = BackendAgendaModel::insertCategory($item); BackendModel::triggerEvent($this->getModule(), 'after_add_category', array('item' => $item)); // everything is saved, so redirect to the overview $this->redirect(BackendModel::createURLForAction('categories') . '&report=added-category&var=' . urlencode($item['title']) . '&highlight=row-' . $item['id']); } } }