- ContentSource handling in message
- ContentSource list, add/update ui
- nextPageSelector and imageSelector can be null
- cleanup
This commit is contained in:
Jérémy Guillot
2024-06-30 20:47:27 +02:00
parent ba30d3102d
commit 3012adfee7
24 changed files with 762 additions and 707 deletions

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Form;
use App\Entity\ContentSource;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ContentSourceType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('baseUrl', UrlType::class, [
'label' => 'Base URL',
])
->add('imageSelector', TextType::class, [
'label' => 'Image Selector',
])
->add('chapterUrlFormat', TextType::class, [
'label' => 'Chapter URL Format',
])
->add('nextPageSelector', TextType::class, [
'label' => 'Next Page Selector (let empty if vertical reader)',
'required' => false,
])
->add('scrapingType', ChoiceType::class, [
'label' => 'Scraping Type',
'choices' => [
'HTML' => 'html',
'JavaScript' => 'javascript'
],
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => ContentSource::class,
]);
}
}