Admin.php.twig 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. {% set code %}
  3. {%- for field in fields %}
  4. ->add('{{ field }}')
  5. {%- endfor %}
  6. {% endset %}
  7. namespace {{ namespace }};
  8. use Sonata\AdminBundle\Admin\AbstractAdmin;
  9. use Sonata\AdminBundle\Datagrid\DatagridMapper;
  10. use Sonata\AdminBundle\Datagrid\ListMapper;
  11. use Sonata\AdminBundle\Form\FormMapper;
  12. use Sonata\AdminBundle\Show\ShowMapper;
  13. class {{ classBasename }} extends AbstractAdmin
  14. {
  15. /**
  16. * @param DatagridMapper $datagridMapper
  17. */
  18. protected function configureDatagridFilters(DatagridMapper $datagridMapper)
  19. {
  20. $datagridMapper
  21. {{- code }}
  22. ;
  23. }
  24. /**
  25. * @param ListMapper $listMapper
  26. */
  27. protected function configureListFields(ListMapper $listMapper)
  28. {
  29. $listMapper
  30. {{- code }}
  31. ->add('_action', null, array(
  32. 'actions' => array(
  33. 'show' => array(),
  34. 'edit' => array(),
  35. 'delete' => array(),
  36. ),
  37. ))
  38. ;
  39. }
  40. /**
  41. * @param FormMapper $formMapper
  42. */
  43. protected function configureFormFields(FormMapper $formMapper)
  44. {
  45. $formMapper
  46. {{- code }}
  47. ;
  48. }
  49. /**
  50. * @param ShowMapper $showMapper
  51. */
  52. protected function configureShowFields(ShowMapper $showMapper)
  53. {
  54. $showMapper
  55. {{- code }}
  56. ;
  57. }
  58. }