protected function createComponentFormNew($name) { $form = new Form($this, $name); $this->createTreeSelect(); $form->addText('name', $this->translator->translate('admin.form.name'))->addRule(Form::FILLED, $this->translator->translate('admin.form.isRequired')); $form->addText('link', $this->translator->translate('page.link')); $form->addCheckbox('is_homepage', $this->translator->translate('page.homepage')); $form->addCheckbox('in_menu', $this->translator->translate('page.showInMenu'))->setDefaultValue(true); $form->addCheckbox('external', $this->translator->translate('page.externalLink')); $form->addSelect('parent_id', $this->translator->translate('page.parentPage'), $this->tree); $form->addSelect('module', $this->translator->translate('page.module'), $this->modules); $form->addSpawEditor('text', $this->translator->translate('admin.form.text')); $form->addText('h1', $this->translator->translate('page.h1')); $form->addText('title', $this->translator->translate('page.title')); $form->addText('keywords', $this->translator->translate('page.keywords')); $form->addTextArea('description', $this->translator->translate('page.description')); $form->addSubmit('send', $this->translator->translate('admin.form.create')); $form->onSuccess[] = $this->submitFormNew; return $form; }
protected function createComponentFormNew($name) { $form = new Form($this, $name); if ($this->getUser()->isInRole('super_admin')) { $roles = $this->roles->order('name')->fetchPairs('id', 'name'); } else { $roles = $this->roles->order('name')->where('NOT system_name', 'super_admin')->fetchPairs('id', 'name'); } $form->addSelect('role_id', $this->translator->translate('admin.user.role'), $roles); $form->addText('name', $this->translator->translate('admin.user.name'))->addRule(Form::FILLED, $this->translator->translate('admin.form.isRequired')); $form->addText('surname', $this->translator->translate('admin.user.surname'))->addRule(Form::FILLED, $this->translator->translate('admin.form.isRequired')); $form->addText('email', $this->translator->translate('admin.form.email'))->addRule(Form::FILLED, $this->translator->translate('admin.form.isRequired'))->addRule(Form::EMAIL, $this->translator->translate('admin.form.mustBeValidEmail')); $form->addPassword('password', $this->translator->translate('admin.form.password'))->addRule(Form::FILLED, $this->translator->translate('admin.form.isRequired')); $form->addPassword('password1', $this->translator->translate('admin.form.passwordRepead'))->addRule(Form::FILLED, $this->translator->translate('admin.form.isRequired'))->addRule(Form::EQUAL, $this->translator->translate('admin.form.passwordMustBeSame'), $form['password']); $form->addSubmit('send', $this->translator->translate('admin.form.create')); $form->onSuccess[] = [$this, 'submitFormNew']; return $form; }
protected function createComponentFormNew($name) { $form = new Form($this, $name); $this->createTreeSelect(); $form->addText('name', $this->translator->translate('category.name'))->addRule(Form::FILLED, $this->translator->translate('admin.form.isRequired')); $form->addText('link', $this->translator->translate('category.link')); $form->addSelect('parent_id', $this->translator->translate('category.parentCategory'), $this->tree); $form->addSubmit('send', $this->translator->translate('admin.form.create')); $form->onSuccess[] = $this->submitFormNew; return $form; }