diff options
author | adev <adev2000@gmail.com> | 2017-05-07 17:21:30 +0200 |
---|---|---|
committer | adev <adev2000@gmail.com> | 2017-06-04 11:38:29 +0200 |
commit | 2c3e148b0029a094431622feac79fafcd0d43fc8 (patch) | |
tree | f59d3d2088af87f3898b4c4de28639b70efbe4b4 /src/Wallabag/AnnotationBundle/Form | |
parent | a687c8d915276eee0c0494156700f7d0c0606735 (diff) | |
download | wallabag-2c3e148b0029a094431622feac79fafcd0d43fc8.tar.gz wallabag-2c3e148b0029a094431622feac79fafcd0d43fc8.tar.zst wallabag-2c3e148b0029a094431622feac79fafcd0d43fc8.zip |
Displays an error with an annotation with a too long quote
Fix #2762
Diffstat (limited to 'src/Wallabag/AnnotationBundle/Form')
-rw-r--r-- | src/Wallabag/AnnotationBundle/Form/EditAnnotationType.php | 18 | ||||
-rw-r--r-- | src/Wallabag/AnnotationBundle/Form/NewAnnotationType.php | 35 | ||||
-rw-r--r-- | src/Wallabag/AnnotationBundle/Form/RangeType.php | 19 |
3 files changed, 72 insertions, 0 deletions
diff --git a/src/Wallabag/AnnotationBundle/Form/EditAnnotationType.php b/src/Wallabag/AnnotationBundle/Form/EditAnnotationType.php new file mode 100644 index 00000000..3b587478 --- /dev/null +++ b/src/Wallabag/AnnotationBundle/Form/EditAnnotationType.php | |||
@@ -0,0 +1,18 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\AnnotationBundle\Form; | ||
4 | |||
5 | use Symfony\Component\Form\AbstractType; | ||
6 | use Symfony\Component\Form\FormBuilderInterface; | ||
7 | |||
8 | class EditAnnotationType extends AbstractType | ||
9 | { | ||
10 | public function buildForm(FormBuilderInterface $builder, array $options) | ||
11 | { | ||
12 | $builder | ||
13 | ->add('text', null, [ | ||
14 | 'empty_data' => '', | ||
15 | ]) | ||
16 | ; | ||
17 | } | ||
18 | } | ||
diff --git a/src/Wallabag/AnnotationBundle/Form/NewAnnotationType.php b/src/Wallabag/AnnotationBundle/Form/NewAnnotationType.php new file mode 100644 index 00000000..c73c3ded --- /dev/null +++ b/src/Wallabag/AnnotationBundle/Form/NewAnnotationType.php | |||
@@ -0,0 +1,35 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\AnnotationBundle\Form; | ||
4 | |||
5 | use Symfony\Component\Form\AbstractType; | ||
6 | use Symfony\Component\Form\Extension\Core\Type\CollectionType; | ||
7 | use Symfony\Component\Form\FormBuilderInterface; | ||
8 | use Symfony\Component\OptionsResolver\OptionsResolver; | ||
9 | use Wallabag\AnnotationBundle\Entity\Annotation; | ||
10 | |||
11 | class NewAnnotationType extends AbstractType | ||
12 | { | ||
13 | public function buildForm(FormBuilderInterface $builder, array $options) | ||
14 | { | ||
15 | $builder | ||
16 | ->add('text', null, [ | ||
17 | 'empty_data' => '', | ||
18 | ]) | ||
19 | ->add('quote', null, [ | ||
20 | 'empty_data' => null, | ||
21 | ]) | ||
22 | ->add('ranges', CollectionType::class, [ | ||
23 | 'entry_type' => RangeType::class, | ||
24 | 'allow_add' => true, | ||
25 | ]) | ||
26 | ; | ||
27 | } | ||
28 | |||
29 | public function configureOptions(OptionsResolver $resolver) | ||
30 | { | ||
31 | $resolver->setDefaults([ | ||
32 | 'data_class' => Annotation::class, | ||
33 | ]); | ||
34 | } | ||
35 | } | ||
diff --git a/src/Wallabag/AnnotationBundle/Form/RangeType.php b/src/Wallabag/AnnotationBundle/Form/RangeType.php new file mode 100644 index 00000000..0647375e --- /dev/null +++ b/src/Wallabag/AnnotationBundle/Form/RangeType.php | |||
@@ -0,0 +1,19 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\AnnotationBundle\Form; | ||
4 | |||
5 | use Symfony\Component\Form\AbstractType; | ||
6 | use Symfony\Component\Form\FormBuilderInterface; | ||
7 | |||
8 | class RangeType extends AbstractType | ||
9 | { | ||
10 | public function buildForm(FormBuilderInterface $builder, array $options) | ||
11 | { | ||
12 | $builder | ||
13 | ->add('start') | ||
14 | ->add('startOffset') | ||
15 | ->add('end') | ||
16 | ->add('endOffset') | ||
17 | ; | ||
18 | } | ||
19 | } | ||