]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/GroupBundle/Form/NewGroupType.php
Added groups management
[github/wallabag/wallabag.git] / src / Wallabag / GroupBundle / Form / NewGroupType.php
diff --git a/src/Wallabag/GroupBundle/Form/NewGroupType.php b/src/Wallabag/GroupBundle/Form/NewGroupType.php
new file mode 100644 (file)
index 0000000..29b20fe
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+
+namespace Wallabag\GroupBundle\Form;
+
+use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\Extension\Core\Type\SubmitType;
+use Symfony\Component\Form\Extension\Core\Type\TextType;
+use Symfony\Component\Form\FormBuilderInterface;
+use Symfony\Component\OptionsResolver\OptionsResolver;
+
+class NewGroupType extends AbstractType
+{
+    public function buildForm(FormBuilderInterface $builder, array $options)
+    {
+        $builder
+            ->add('name', TextType::class, [
+                'required' => true,
+                'label' => 'group.form.name_label',
+            ])
+            ->add('save', SubmitType::class, [
+                'label' => 'group.form.save',
+            ])
+        ;
+    }
+
+    public function configureOptions(OptionsResolver $resolver)
+    {
+        $resolver->setDefaults([
+            'data_class' => 'Wallabag\GroupBundle\Entity\Group',
+        ]);
+    }
+
+    public function getBlockPrefix()
+    {
+        return 'new_group';
+    }
+}