From: Raphaƫl Gertz Date: Sun, 25 Feb 2018 05:04:49 +0000 (+0100) Subject: Add form files X-Git-Tag: 0.1~65 X-Git-Url: https://git.rapsys.eu/blogbundle/commitdiff_plain/2170a08e8b827db071883ad0b539a3ff97d6cd97 Add form files --- diff --git a/Form/ArticleType.php b/Form/ArticleType.php new file mode 100644 index 0000000..346ae88 --- /dev/null +++ b/Form/ArticleType.php @@ -0,0 +1,36 @@ +add('created')->add('updated')->add('site')->add('author')->add('keywords'); + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'Rapsys\BlogBundle\Entity\Article' + )); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'rapsys_blogbundle_article'; + } +} diff --git a/Form/AuthorType.php b/Form/AuthorType.php new file mode 100644 index 0000000..9a908a4 --- /dev/null +++ b/Form/AuthorType.php @@ -0,0 +1,36 @@ +add('name')->add('slug')->add('created')->add('updated'); + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'Rapsys\BlogBundle\Entity\Author' + )); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'rapsys_blogbundle_author'; + } +} diff --git a/Form/ContactType.php b/Form/ContactType.php new file mode 100644 index 0000000..07c8eb0 --- /dev/null +++ b/Form/ContactType.php @@ -0,0 +1,40 @@ +add('name', TextType::class, array('attr' => array('placeholder' => 'Your name'), 'constraints' => array(new NotBlank(array("message" => "Please provide your name"))))) + ->add('subject', TextType::class, array('attr' => array('placeholder' => 'Subject'), 'constraints' => array(new NotBlank(array("message" => "Please give a Subject"))))) + ->add('email', EmailType::class, array('attr' => array('placeholder' => 'Your email address'), 'constraints' => array(new NotBlank(array("message" => "Please provide a valid email")), new Email(array("message" => "Your email doesn't seems to be valid"))))) + ->add('message', TextareaType::class, array('attr' => array('placeholder' => 'Your message here', 'cols' => 50, 'rows' => 15), 'constraints' => array(new NotBlank(array("message" => "Please provide a message here"))))) + ->add('submit', SubmitType::class, array('label' => 'Send', 'attr' => array('class' => 'submit'))); + } + + /** + * {@inheritdoc} + */ + public function setDefaultOptions(OptionsResolver $resolver) { + $resolver->setDefaults(array('error_bubbling' => true)); + } + + /** + * {@inheritdoc} + */ + public function getName() { + return 'contact_form'; + } +} diff --git a/Form/KeywordType.php b/Form/KeywordType.php new file mode 100644 index 0000000..895842b --- /dev/null +++ b/Form/KeywordType.php @@ -0,0 +1,36 @@ +add('created')->add('updated')->add('articles'); + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'Rapsys\BlogBundle\Entity\Keyword' + )); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'rapsys_blogbundle_keyword'; + } +} diff --git a/Form/LanguageType.php b/Form/LanguageType.php new file mode 100644 index 0000000..5b4d153 --- /dev/null +++ b/Form/LanguageType.php @@ -0,0 +1,36 @@ +add('iso6391')->add('iso6393')->add('created')->add('updated'); + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'Rapsys\BlogBundle\Entity\Language' + )); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'rapsys_blogbundle_language'; + } +} diff --git a/Form/SiteType.php b/Form/SiteType.php new file mode 100644 index 0000000..5e7cc1b --- /dev/null +++ b/Form/SiteType.php @@ -0,0 +1,36 @@ +add('domain')->add('created')->add('updated'); + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'Rapsys\BlogBundle\Entity\Site' + )); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'rapsys_blogbundle_site'; + } +}