可能性を見つけました:テキストテンプレートのbase_list_field.html.twigテンプレートをオーバーライドします:nl2br
ブロックfield
が定義されたときにフィルターを追加します:
list_text_field.html.twig
<td class="sonata-ba-list-field sonata-ba-list-field-{{ field_description.type }}" objectId="{{ admin.id(object) }}">
{% if
field_description.options.identifier is defined
and field_description.options.route is defined
and admin.isGranted(field_description.options.route.name == 'show' ? 'VIEW' : field_description.options.route.name|upper, object)
and admin.hasRoute(field_description.options.route.name)
%}
<a href="{{ admin.generateObjectUrl(field_description.options.route.name, object, field_description.options.route.parameters) }}">
{%- block field %}{{ value|nl2br }}{% endblock -%}
</a>
{% else %}
{{ block('field') }}
{% endif %}
</td>
あなたのconfig.yml
:
sonata_doctrine_orm_admin:
templates:
types:
list:
text: YourBundle:Admin:list_text_field.html.twig
configureListFields
$listMapper->add('test', 'text', array('label' => 'Test'))