Configurable PDF exports (#5641)
This commit is contained in:
@@ -12,22 +12,71 @@ namespace App\Form;
|
||||
use App\Entity\ExportTemplate;
|
||||
use App\Form\Type\ExportColumnsType;
|
||||
use App\Form\Type\ExportRendererType;
|
||||
use App\Form\Type\ExportSummaryColumnsType;
|
||||
use App\Form\Type\LanguageType;
|
||||
use App\Form\Type\PdfFontType;
|
||||
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\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Validator\Constraints\Length;
|
||||
|
||||
class ExportTemplateSpreadsheetForm extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder->add('title', TextType::class);
|
||||
$builder->add('title', TextType::class, ['label' => 'name']);
|
||||
$builder->add('renderer', ExportRendererType::class, ['label' => 'type']);
|
||||
$builder->add('language', LanguageType::class, ['required' => false]);
|
||||
$builder->add('columns', ExportColumnsType::class, ['required' => true]);
|
||||
$builder->add('separator', ChoiceType::class, ['choices' => ['Comma (,)' => ',', 'Semicolon (;)' => ';'], 'required' => true]);
|
||||
|
||||
$builder->add('separator', ChoiceType::class, [
|
||||
'choices' => ['Comma (,)' => ',', 'Semicolon (;)' => ';'],
|
||||
'row_attr' => ['data-type' => 'csv'],
|
||||
'required' => true,
|
||||
]);
|
||||
|
||||
$builder->add('name', TextType::class, [
|
||||
'label' => 'title',
|
||||
'constraints' => [new Length(max: 100)],
|
||||
'attr' => ['maxlength' => 100],
|
||||
'row_attr' => ['data-type' => 'pdf'],
|
||||
'required' => false,
|
||||
]);
|
||||
|
||||
$builder->add('summaryColumns', ExportSummaryColumnsType::class, [
|
||||
'row_attr' => ['data-type' => 'pdf'],
|
||||
'required' => false,
|
||||
]);
|
||||
|
||||
$builder->add('font', PdfFontType::class, [
|
||||
'row_attr' => ['data-type' => 'pdf'],
|
||||
'required' => false,
|
||||
]);
|
||||
|
||||
$builder->add('pageSize', ChoiceType::class, [
|
||||
'label' => 'pageSize',
|
||||
'choices' => [
|
||||
'A4' => 'A4',
|
||||
'A5' => 'A5',
|
||||
'A6' => 'A6',
|
||||
'Legal' => 'Legal',
|
||||
'Letter' => 'Letter',
|
||||
],
|
||||
'row_attr' => ['data-type' => 'pdf'],
|
||||
'required' => false,
|
||||
]);
|
||||
|
||||
$builder->add('orientation', ChoiceType::class, [
|
||||
'label' => 'orientation',
|
||||
'choices' => [
|
||||
'portrait' => 'portrait',
|
||||
'landscape' => 'landscape',
|
||||
],
|
||||
'row_attr' => ['data-type' => 'pdf'],
|
||||
'required' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
|
||||
Reference in New Issue
Block a user