AdminExtensionInterface.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <?php
  2. /*
  3. * This file is part of the Sonata Project 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 Knp\Menu\ItemInterface as MenuItemInterface;
  12. use Sonata\AdminBundle\Datagrid\DatagridMapper;
  13. use Sonata\AdminBundle\Datagrid\ListMapper;
  14. use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
  15. use Sonata\AdminBundle\Form\FormMapper;
  16. use Sonata\AdminBundle\Route\RouteCollection;
  17. use Sonata\AdminBundle\Show\ShowMapper;
  18. use Sonata\CoreBundle\Validator\ErrorElement;
  19. /**
  20. * Interface AdminExtensionInterface.
  21. *
  22. * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
  23. */
  24. interface AdminExtensionInterface
  25. {
  26. /**
  27. * @param FormMapper $form
  28. */
  29. public function configureFormFields(FormMapper $form);
  30. /**
  31. * @param ListMapper $list
  32. */
  33. public function configureListFields(ListMapper $list);
  34. /**
  35. * @param DatagridMapper $filter
  36. */
  37. public function configureDatagridFilters(DatagridMapper $filter);
  38. /**
  39. * @param ShowMapper $show
  40. */
  41. public function configureShowFields(ShowMapper $show);
  42. /**
  43. * @param AdminInterface $admin
  44. * @param RouteCollection $collection
  45. */
  46. public function configureRoutes(AdminInterface $admin, RouteCollection $collection);
  47. /**
  48. * DEPRECATED: Use configureTabMenu instead.
  49. *
  50. * @param AdminInterface $admin
  51. * @param MenuItemInterface $menu
  52. * @param string $action
  53. * @param AdminInterface $childAdmin
  54. *
  55. * @return mixed
  56. *
  57. * @deprecated
  58. */
  59. public function configureSideMenu(AdminInterface $admin, MenuItemInterface $menu, $action, AdminInterface $childAdmin = null);
  60. /**
  61. * Builds the tab menu.
  62. *
  63. * @param AdminInterface $admin
  64. * @param MenuItemInterface $menu
  65. * @param string $action
  66. * @param AdminInterface $childAdmin
  67. *
  68. * @return mixed
  69. */
  70. public function configureTabMenu(AdminInterface $admin, MenuItemInterface $menu, $action, AdminInterface $childAdmin = null);
  71. /**
  72. * @param AdminInterface $admin
  73. * @param ErrorElement $errorElement
  74. * @param mixed $object
  75. */
  76. public function validate(AdminInterface $admin, ErrorElement $errorElement, $object);
  77. /**
  78. * @param AdminInterface $admin
  79. * @param ProxyQueryInterface $query
  80. * @param string $context
  81. *
  82. * @return mixed
  83. */
  84. public function configureQuery(AdminInterface $admin, ProxyQueryInterface $query, $context = 'list');
  85. /**
  86. * Get a chance to modify a newly created instance.
  87. *
  88. * @param AdminInterface $admin
  89. * @param mixed $object
  90. */
  91. public function alterNewInstance(AdminInterface $admin, $object);
  92. /**
  93. * Get a chance to modify object instance.
  94. *
  95. * @param AdminInterface $admin
  96. * @param $object
  97. *
  98. * @return mixed
  99. */
  100. public function alterObject(AdminInterface $admin, $object);
  101. /**
  102. * Get a chance to add persistent parameters.
  103. *
  104. * @param AdminInterface $admin
  105. *
  106. * @return array
  107. */
  108. public function getPersistentParameters(AdminInterface $admin);
  109. /**
  110. * @param AdminInterface $admin
  111. * @param mixed $object
  112. */
  113. public function preUpdate(AdminInterface $admin, $object);
  114. /**
  115. * @param AdminInterface $admin
  116. * @param mixed $object
  117. */
  118. public function postUpdate(AdminInterface $admin, $object);
  119. /**
  120. * @param AdminInterface $admin
  121. * @param mixed $object
  122. */
  123. public function prePersist(AdminInterface $admin, $object);
  124. /**
  125. * @param AdminInterface $admin
  126. * @param mixed $object
  127. */
  128. public function postPersist(AdminInterface $admin, $object);
  129. /**
  130. * @param AdminInterface $admin
  131. * @param mixed $object
  132. */
  133. public function preRemove(AdminInterface $admin, $object);
  134. /**
  135. * @param AdminInterface $admin
  136. * @param mixed $object
  137. */
  138. public function postRemove(AdminInterface $admin, $object);
  139. }