public function createComponentFormCategory($name) { $form = new LiveForm($this, $name); $form->addText('title', 'Title')->addRule(Form::FILLED, 'Fill title'); try { $categories = $this->model('categories')->getIdLevel(); } catch (DibiDriverException $e) { $this->flash($e->getMessage()); $categories = array(); } $categories = array('0;0' => 'none') + $categories; $form->addSelect('parent', 'Parent', $categories); $form->addTextarea('description', 'Description'); $templates = array('category' => 'default'); $form->addSelect('template', 'template', $templates); $form->addButton('btnClose', 'Close'); $form->addSubmit('btnSave', 'Save')->onClick[] = array($this, 'formNewCategorySubmitted'); return $form; }