add company form for updating the company
This commit is contained in:
parent
dce5dcab2f
commit
f454888a6f
51
src/Form/InternalCompanyFormType.php
Normal file
51
src/Form/InternalCompanyFormType.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form;
|
||||||
|
|
||||||
|
use App\Entity\Company;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||||
|
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 InternalCompanyFormType extends AbstractType
|
||||||
|
{
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
|
{
|
||||||
|
$builder
|
||||||
|
->add('name', TextType::class, [
|
||||||
|
'required' => true,
|
||||||
|
'attr' => [
|
||||||
|
'placeholder' => 'Company Name',
|
||||||
|
'class' => 'form-control',
|
||||||
|
'autofocus' => true,
|
||||||
|
'autocomplete' => 'off'
|
||||||
|
]
|
||||||
|
])
|
||||||
|
->add('address', TextType::class)
|
||||||
|
->add('city', TextType::class)
|
||||||
|
->add('state', TextType::class)
|
||||||
|
->add('zip', TextType::class)
|
||||||
|
->add('phone', TextType::class)
|
||||||
|
->add('email', EmailType::class)
|
||||||
|
->add('url', UrlType::class, ['required' => false])
|
||||||
|
->add('companyLogo', FileType::class, [
|
||||||
|
'required' => false,
|
||||||
|
'mapped' => false
|
||||||
|
])
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
'data_class' => Company::class,
|
||||||
|
'csrf_protection' => true,
|
||||||
|
'csrf_field_name' => '_token',
|
||||||
|
'csrf_token_id' => 'company',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user