I'm rendering a custom twig template within sonata_type_model_autocomplete
Works perfectly fine in
"sonata-project/admin-bundle": "3.27"
$formMapper
->add('example_type', 'sonata_type_model_autocomplete', array(
'container_css_class' => 'select2-image',
'class' => 'AppBundle:ExampleType',
'to_string_callback' => function($entity, $property) use ($engine) {
return $engine->render(
'AppBundle:ExampleTypeAdmin:autocomplete_example_type.html.twig',
['example' => $entity]
);
},
))
;
"sonata-project/admin-bundle": "3.28"
Latest admin bundle renders the selection as "string", is there a new way to render it HTML RAW?

Sorry, but we try to keep github issues for feature requests and bugs only.
@core23 this is a bug. You broke BC
https://stackoverflow.com/questions/34356403/how-customize-display-data-in-sonata-autocomplete
Can you please name the PR which broke the BC?
The only thing that could effect the Select2 is this PR.
https://github.com/sonata-project/SonataAdminBundle/pull/4796/files
Just tested this using my project and wanted to confirm this PR #4796 prevent passing HTML through label, there is currently no bypass available. By preventing HTML passthrough you would not be able to take advantage of template in Select2 drop-down option select2
@ossinkine
Maybe you could provide a PR where you can pass a new option to force html rendering.
HTML should be disabled in default for security reasons.
As workaround you can extend the template and override sonata_type_model_autocomplete_dropdown_item_format and sonata_type_model_autocomplete_selection_format blocks.
New option like is_safe in Twig will be great.
Most helpful comment
As workaround you can extend the template and override
sonata_type_model_autocomplete_dropdown_item_formatandsonata_type_model_autocomplete_selection_formatblocks.New option like
is_safein Twig will be great.