forked from wallabag/wallabag
18
src/Wallabag/AnnotationBundle/Form/EditAnnotationType.php
Normal file
18
src/Wallabag/AnnotationBundle/Form/EditAnnotationType.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\AnnotationBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class EditAnnotationType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('text', null, [
|
||||
'empty_data' => '',
|
||||
])
|
||||
;
|
||||
}
|
||||
}
|
||||
35
src/Wallabag/AnnotationBundle/Form/NewAnnotationType.php
Normal file
35
src/Wallabag/AnnotationBundle/Form/NewAnnotationType.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\AnnotationBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Wallabag\AnnotationBundle\Entity\Annotation;
|
||||
|
||||
class NewAnnotationType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('text', null, [
|
||||
'empty_data' => '',
|
||||
])
|
||||
->add('quote', null, [
|
||||
'empty_data' => null,
|
||||
])
|
||||
->add('ranges', CollectionType::class, [
|
||||
'entry_type' => RangeType::class,
|
||||
'allow_add' => true,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Annotation::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
19
src/Wallabag/AnnotationBundle/Form/RangeType.php
Normal file
19
src/Wallabag/AnnotationBundle/Form/RangeType.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\AnnotationBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class RangeType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('start')
|
||||
->add('startOffset')
|
||||
->add('end')
|
||||
->add('endOffset')
|
||||
;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user