With EasyAdmin Symfony bundle, with Symfony 4.2, how create a new list field type?
Use case
"I want to display a link to show page in the list table"
(not a form type, a list type):
easy_admin:
entities:
offer:
class: App\Entity\Offer
list:
fields:
- { property: name, type: MY_TYPE??? }
You have 2 solutions i believe :
It allows you to display an url :
# config/packages/easy_admin.yaml
easy_admin:
entities:
Product:
class: App\Entity\User
list:
fields:
- { property: 'blogUrl', type: 'url' }
This way you can define a custom template to generate your url and pass a param if you need :
# config/packages/easy_admin.yaml
easy_admin:
entities:
Product:
class: App\Entity\Product
list:
fields:
# ...
- { property: 'tags', template: 'admin/tag_collection.html.twig',
label_colors: ['primary', 'success', 'info'] }