AdminExtensionInterface.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?php
  2. /*
  3. * This file is part of the Sonata package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Sonata\AdminBundle\Admin;
  11. use Sonata\AdminBundle\Form\FormMapper;
  12. use Sonata\AdminBundle\Datagrid\ListMapper;
  13. use Sonata\AdminBundle\Datagrid\DatagridMapper;
  14. use Sonata\AdminBundle\Show\ShowMapper;
  15. use Sonata\AdminBundle\Route\RouteCollection;
  16. use Sonata\AdminBundle\Validator\ErrorElement;
  17. use Sonata\AdminBundle\Admin\AdminInterface;
  18. use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
  19. use Knp\Menu\ItemInterface as MenuItemInterface;
  20. /**
  21. *
  22. */
  23. interface AdminExtensionInterface
  24. {
  25. /**
  26. * @param FormMapper $form
  27. */
  28. public function configureFormFields(FormMapper $form);
  29. /**
  30. * @param ListMapper $list
  31. */
  32. public function configureListFields(ListMapper $list);
  33. /**
  34. * @param DatagridMapper $filter
  35. */
  36. public function configureDatagridFilters(DatagridMapper $filter);
  37. /**
  38. * @param ShowMapper $filter
  39. */
  40. public function configureShowFields(ShowMapper $filter);
  41. /**
  42. * @param AdminInterface $admin
  43. * @param RouteCollection $collection
  44. */
  45. public function configureRoutes(AdminInterface $admin, RouteCollection $collection);
  46. /**
  47. * @param AdminInterface $admin
  48. * @param MenuItemInterface $menu
  49. * @param string $action
  50. * @param AdminInterface $childAdmin
  51. *
  52. * @return mixed
  53. */
  54. public function configureSideMenu(AdminInterface $admin, MenuItemInterface $menu, $action, AdminInterface $childAdmin = null);
  55. /**
  56. * @param AdminInterface $admin
  57. * @param ErrorElement $errorElement
  58. * @param mixed $object
  59. */
  60. public function validate(AdminInterface $admin, ErrorElement $errorElement, $object);
  61. /**
  62. * @param AdminInterface $admin
  63. * @param ProxyQueryInterface $query
  64. * @param string $context
  65. *
  66. * @return mixed
  67. */
  68. public function configureQuery(AdminInterface $admin, ProxyQueryInterface $query, $context = 'list');
  69. /**
  70. * Get a chance to modify a newly created instance.
  71. *
  72. * @param AdminInterface $admin
  73. * @param mixed $object
  74. */
  75. public function alterNewInstance(AdminInterface $admin, $object);
  76. /**
  77. * Get a chance to modify object instance
  78. *
  79. * @param AdminInterface $admin
  80. * @param $object
  81. * @return mixed
  82. */
  83. public function alterObject(AdminInterface $admin, $object);
  84. /**
  85. * Get a chance to add persistent parameters
  86. *
  87. * @param AdminInterface $admin
  88. * @return array
  89. */
  90. public function getPersistentParameters(AdminInterface $admin);
  91. /**
  92. * @param AdminInterface $admin
  93. * @param mixed $object
  94. */
  95. public function preUpdate(AdminInterface $admin, $object);
  96. /**
  97. * @param AdminInterface $admin
  98. * @param mixed $object
  99. */
  100. public function postUpdate(AdminInterface $admin, $object);
  101. /**
  102. * @param AdminInterface $admin
  103. * @param mixed $object
  104. */
  105. public function prePersist(AdminInterface $admin, $object);
  106. /**
  107. * @param AdminInterface $admin
  108. * @param mixed $object
  109. */
  110. public function postPersist(AdminInterface $admin, $object);
  111. /**
  112. * @param AdminInterface $admin
  113. * @param mixed $object
  114. */
  115. public function preRemove(AdminInterface $admin, $object);
  116. /**
  117. * @param AdminInterface $admin
  118. * @param mixed $object
  119. */
  120. public function postRemove(AdminInterface $admin, $object);
  121. }