protected function createComponentGalleryForm() { $form = AsterixForm::horizontalForm(); $form->setTranslator($this->translator); $form->addASelect('translate', 'admin.gallery.form.translate', $this->gallery->getAllGalleryPair())->setPrompt(''); $form->addASelect('language', 'admin.gallery.form.language', Languages::toArray())->setIconBefore('fa-language')->setDefaultValue($this->lang); $form->addAText('name', 'admin.gallery.form.name', Width::WIDTH_8)->setMaxLength(30)->setRequired($this->translator->translate('admin.gallery.form.required', ['text' => '%label'])); $form->addATextArea('text', 'admin.gallery.form.description', Width::WIDTH_8)->setAttribute('rows', 5); $form->addAUpload('images', 'admin.gallery.form.image', null, true)->addCondition(Form::FILLED)->addRule(Form::IMAGE, 'admin.gallery.form.imageError'); $form->addHidden("idGallery"); $form->addHidden('lang'); $form->addASubmit('send', 'admin.gallery.form.button'); $form->onSuccess[] = $this->galleryFormSucceeded; $form->onError[] = $this->galleryFormSucceeded; return $form; }
protected function createComponentAddArticleForm() { $form = AsterixForm::horizontalForm(); $form->setTranslator($this->translator); $form->addASelect('translate', 'admin.article.form.translate', $this->article->getAllArticlesPair())->setPrompt(''); $form->addASelect('language', 'admin.article.form.language', Languages::toArray())->setIconBefore('fa-language')->setDefaultValue($this->lang); $form->addAText('title', 'admin.article.form.title', Width::WIDTH_8)->setRequired($this->translator->translate('admin.article.form.required', ['text' => '%label']))->setMaxLength(80); $form->addATextArea('text', 'admin.article.form.text', Width::WIDTH_8)->setAttribute('rows', 10); $form->addAButtonUpload('image', 'admin.article.form.image', Width::WIDTH_8)->addCondition(Form::FILLED)->addRule(Form::IMAGE, 'admin.article.form.imageError'); $form->addAText('keywords', 'admin.article.form.keywords')->setTooltip($this->translator->translate('admin.article.form.keywordsHelp')); $form->addAText('description', 'admin.article.form.description'); $form->addHidden('author', $this->userEntity->email); $form->addHidden('idArticle', null); $form->addHidden('lang', null); $form->addASubmit('send', 'admin.article.form.submit', ButtonTypes::PRIMARY); $form->getComponent('send')->getControlPrototype()->onclick('tinyMCE.triggerSave()'); $form->onSuccess[] = $this->addArticleSucceeded; return $form; }