0

I'm using SonataAdminBundle and I'm looking at trying to have a form filter on the dashboard.

I have an admin service and I can use the filter in the list for my entity Locations

Is there a way I can use the same filter on the admin dashboard, and when I submit such filter, it will redirect to the correct list action with the filtered results?

Thanks

user789122
  • 480
  • 5
  • 12
  • 25

1 Answers1

0

Basically, the admin dashboard uses BlockServices to display its contents. Hence, what you'll need to do is create a new Block Service to display your list. As for the filter, I think the easiest and fastest way will be to customize your query in the block filter.

You may use the RecentOrdersBlockService implementation in sonata ecommerce as an example: https://github.com/sonata-project/ecommerce/blob/master/src/Sonata/OrderBundle/Block/RecentOrdersBlockService.php ; implementation available in the sonata demo: https://github.com/sonata-project/sandbox/blob/2.3-develop/app/config/sonata/sonata_block.yml

Hugo Briand
  • 1,683
  • 20
  • 27