我想在listMapper中修改“Benefice”字段的样式。
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('id')
->add('date')
->add("nombreMatch")
->add('cote')
->add('mise')
->add('gain')
->add('benefice',null,array(
'attr' => array('style' => 'color:red;'),
));
}
}
我使用“attr”属性但它确实有用。我也尝试“header_style”属性,它确实有效。
如果有人有解决方案,
感谢您的帮助:)
答案 0 :(得分:0)
答案 1 :(得分:0)
我找到了解决方案,谢谢!
对于遇到同样问题的其他人:
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('id', null ,[
'header_style' => 'width: 14%',
])
->add('date', null ,[
'header_style' => 'width: 14%',
])
->add("nombreMatch", null ,[
'header_style' => 'width: 14%',
])
->add('cote', null ,[
'header_style' => 'width: 14%',
])
->add('mise', null ,[
'header_style' => 'width: 14%',
])
->add('gain', null ,[
'header_style' => 'width: 14%',
])
->add('benefice', null, array('template' => '@SonataAdmin/CRUD/Special/benefice_field_list.html.twig'))
;
}
{% extends '@SonataAdmin/CRUD/base_list_field.html.twig' %}
{% block field%}
<div>
<strong>{{ object.benefice }}</strong>
</div>
{% endblock %}