mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
location admin: improve admin crud for location
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
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;
|
||||
@@ -10,15 +9,18 @@ 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;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
final class LocationType extends AbstractType
|
||||
final class LocationFormType extends AbstractType
|
||||
{
|
||||
|
||||
// private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
// public function __construct(
|
||||
// TranslatableStringHelper $translatableStringHelper
|
||||
// ) {
|
||||
// /**
|
||||
// * @param TranslatableStringHelper $translatableStringHelper
|
||||
// */
|
||||
// public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||
// {
|
||||
// $this->translatableStringHelper = $translatableStringHelper;
|
||||
// }
|
||||
|
||||
@@ -33,7 +35,7 @@ final class LocationType extends AbstractType
|
||||
->add('locationType', EntityType::class, [
|
||||
'class' => EntityLocationType::class,
|
||||
'choice_label' => function (EntityLocationType $entity) {
|
||||
//return $this->translatableStringHelper->localize($entity->getTitle());
|
||||
//return $this->translatableStringHelper->localize($entity->getTitle()); //TODO not working. Cannot pass smthg in the constructor
|
||||
return $entity->getTitle()['fr'];
|
||||
},
|
||||
])
|
||||
@@ -44,4 +46,24 @@ final class LocationType extends AbstractType
|
||||
'mapped' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param OptionsResolverInterface $resolver
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'Chill\MainBundle\Entity\Location'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBlockPrefix()
|
||||
{
|
||||
return 'chill_mainbundle_location';
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user