Added:
- ContentSource handling in message - ContentSource list, add/update ui - nextPageSelector and imageSelector can be null - cleanup
This commit is contained in:
46
src/Form/ContentSourceType.php
Normal file
46
src/Form/ContentSourceType.php
Normal 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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user