AdminExtensionInterface.php 4.1 KB

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