|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
public function buildForm(FormBuilderInterface $builder, array $options) |
|
|
public function buildForm(FormBuilderInterface $builder, array $options) |
|
|
{ |
|
|
{ |
|
|
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { |
|
|
|
|
|
|
|
|
dump($options); |
|
|
|
|
|
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event, $options) { |
|
|
$builder = $event->getForm()->getParent(); |
|
|
$builder = $event->getForm()->getParent(); |
|
|
|
|
|
|
|
|
$builder->add('unit', ChoiceType::class, [ |
|
|
$builder->add('unit', ChoiceType::class, [ |
|
|
'required' => true, |
|
|
'required' => true, |
|
|
'translation_domain'=>'lcshop', |
|
|
'translation_domain'=>'lcshop', |
|
|
'expanded'=>true, |
|
|
'expanded'=>true, |
|
|
|
|
|
'data'=> $options['data'], |
|
|
'choices' => [ |
|
|
'choices' => [ |
|
|
'field.default.percent' => 'percent', |
|
|
'field.default.percent' => 'percent', |
|
|
'field.default.amount' => 'amount' |
|
|
'field.default.amount' => 'amount' |