Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3925

Sonata Admin List Field Template is Ignored

$
0
0

I'm using Symfony 4.1.1 and Sonata Admin Bundle 3.35.2.

I want to use a custom template for a field in an admin's list view. The template is ignored. I am using Twig as my templating engine.

In the admin:

# /src/Admin/ImageAdmin.phpprotected function configureListFields(ListMapper $listMapper) {    $listMapper        ->add('filename', 'string', ['template' => 'list_image.html.twig'])    ;}

The template:

# /templates/list_image.html.twig{% extends 'SonataAdminBundle:CRUD:base_list_field.html.twig' %}{% block field %}<img src="{{ value }}" style="width: 200px" />{% endblock %}

Viewing all articles
Browse latest Browse all 3925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>