public function createComponentForm() { $form = new \RequestButton\RequestButtonReceiver(); $form->setTranslator($this->translator); $form->addText('name', 'Name')->addRule(Form::FILLED, 'Please, enter name of gallery.'); $form->addTextarea('description', 'Description'); $form->addSelect('account_id', 'Owner', $this->system->getAccountsToSelect())->value = $this->user->isLoggedIn() ? $this->user->getIdentity()->id : NULL; $form->addCheckbox('visible', 'Visibility'); $form->onSuccess[] = array($this, 'saveItem'); if ($this->getView() == 'add') { $form->addSubmit('add', 'Save & Add next')->getControlPrototype()->class('primary'); $form->addSubmit('leave', 'Save & Leave'); } else { $form->addHidden('id'); $form->addSubmit('leave', 'Save & Leave')->getControlPrototype()->class('primary'); $form->addSubmit('add', 'Save & Add new'); } $form->addSubmit('save', 'Save'); $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = 'CancelClicked'; $form['cancel']->getControlPrototype()->class('cancel'); return $form; }