Answer the question
In order to leave comments, you need to log in
How to display a piece of html in edit SonataAdmin?
In list and show, you can pass null as the second argument in $formmapper->add and then specify template in the parameters where the field value (in this case, there is a model) from the first argument will be passed. But if you do this in configureFormFields, then it starts to swear that you need to set the type. I tried to create a custom fieldType, but I can't pass the template there. It takes some default value:
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['template'] = $options['template'];
}
public function configureOptions(OptionsResolver $resolver)
{
$options = [];
$resolver->setDefaults(array_merge($options, [
'template' => '',
]));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question