mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
fix routes and translatable string in admin prototype
ref #12 ref #13 ref #14 ref #15
This commit is contained in:
@@ -5,9 +5,23 @@ namespace Chill\EventBundle\Form;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Chill\EventBundle\Entity\EventType;
|
||||
|
||||
class RoleType extends AbstractType
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var TranslatableStringHelper
|
||||
*/
|
||||
protected $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper) {
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param array $options
|
||||
@@ -15,9 +29,14 @@ class RoleType extends AbstractType
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('name')
|
||||
->add('name', TranslatableStringFormType::class)
|
||||
->add('active')
|
||||
->add('type')
|
||||
->add('type', EntityType::class, array(
|
||||
'class' => EventType::class,
|
||||
'choice_label' => function (EventType $e) {
|
||||
return $this->translatableStringHelper->localize($e->getName());
|
||||
}
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user