mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
location admin: admin crud for location
This commit is contained in:
47
src/Bundle/ChillMainBundle/Form/LocationType.php
Normal file
47
src/Bundle/ChillMainBundle/Form/LocationType.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\MainBundle\Form;
|
||||
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
use Chill\MainBundle\Entity\LocationType as EntityLocationType;
|
||||
use Chill\MainBundle\Form\Type\PickAddressType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
final class LocationType extends AbstractType
|
||||
{
|
||||
|
||||
// private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
// public function __construct(
|
||||
// TranslatableStringHelper $translatableStringHelper
|
||||
// ) {
|
||||
// $this->translatableStringHelper = $translatableStringHelper;
|
||||
// }
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
|
||||
$builder
|
||||
->add('name', TextType::class)
|
||||
->add('phonenumber1', TextType::class, ['required' => false])
|
||||
->add('phonenumber2', TextType::class, ['required' => false])
|
||||
->add('email', TextType::class, ['required' => false])
|
||||
->add('locationType', EntityType::class, [
|
||||
'class' => EntityLocationType::class,
|
||||
'choice_label' => function (EntityLocationType $entity) {
|
||||
//return $this->translatableStringHelper->localize($entity->getTitle());
|
||||
return $entity->getTitle()['fr'];
|
||||
},
|
||||
])
|
||||
->add('address', PickAddressType::class, [
|
||||
'label' => 'Address',
|
||||
'use_valid_from' => false,
|
||||
'use_valid_to' => false,
|
||||
'mapped' => false,
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user