2015-06-02 16:54:34 +00:00
|
|
|
<?php
|
|
|
|
|
2024-02-19 00:30:12 +00:00
|
|
|
namespace Wallabag\Form\Type;
|
2015-06-02 16:54:34 +00:00
|
|
|
|
|
|
|
use Symfony\Component\Form\AbstractType;
|
2015-12-22 09:16:34 +00:00
|
|
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
2017-11-05 14:32:57 +00:00
|
|
|
use Symfony\Component\Form\Extension\Core\Type\UrlType;
|
2015-06-02 16:54:34 +00:00
|
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
2024-02-19 00:30:12 +00:00
|
|
|
use Wallabag\Entity\Entry;
|
2015-06-02 16:54:34 +00:00
|
|
|
|
|
|
|
class EditEntryType extends AbstractType
|
|
|
|
{
|
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
|
|
{
|
|
|
|
$builder
|
2016-04-12 09:36:01 +00:00
|
|
|
->add('title', TextType::class, [
|
2016-03-09 07:59:08 +00:00
|
|
|
'required' => true,
|
|
|
|
'label' => 'entry.edit.title_label',
|
2016-04-12 09:36:01 +00:00
|
|
|
])
|
2017-11-05 14:32:57 +00:00
|
|
|
->add('url', UrlType::class, [
|
2016-03-09 07:59:08 +00:00
|
|
|
'disabled' => true,
|
|
|
|
'required' => false,
|
|
|
|
'label' => 'entry.edit.url_label',
|
2019-02-08 14:03:52 +00:00
|
|
|
'default_protocol' => null,
|
2016-04-12 09:36:01 +00:00
|
|
|
])
|
2017-11-05 14:32:57 +00:00
|
|
|
->add('origin_url', UrlType::class, [
|
2017-09-09 17:32:42 +00:00
|
|
|
'required' => false,
|
|
|
|
'property_path' => 'originUrl',
|
|
|
|
'label' => 'entry.edit.origin_url_label',
|
2019-02-08 14:03:52 +00:00
|
|
|
'default_protocol' => null,
|
2017-09-09 17:32:42 +00:00
|
|
|
])
|
2016-04-12 09:36:01 +00:00
|
|
|
->add('save', SubmitType::class, [
|
2016-03-09 07:59:08 +00:00
|
|
|
'label' => 'entry.edit.save_label',
|
2016-04-12 09:36:01 +00:00
|
|
|
])
|
2015-06-02 16:54:34 +00:00
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function configureOptions(OptionsResolver $resolver)
|
|
|
|
{
|
2016-04-12 09:36:01 +00:00
|
|
|
$resolver->setDefaults([
|
2022-09-01 18:54:56 +00:00
|
|
|
'data_class' => Entry::class,
|
2016-04-12 09:36:01 +00:00
|
|
|
]);
|
2015-06-02 16:54:34 +00:00
|
|
|
}
|
|
|
|
|
2015-12-22 09:16:34 +00:00
|
|
|
public function getBlockPrefix()
|
2015-06-02 16:54:34 +00:00
|
|
|
{
|
|
|
|
return 'entry';
|
|
|
|
}
|
|
|
|
}
|