AdminExtensionInterface.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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\Datagrid\ProxyQueryInterface;
  18. use Knp\Menu\ItemInterface as MenuItemInterface;
  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. * @return mixed
  96. */
  97. public function alterObject(AdminInterface $admin, $object);
  98. /**
  99. * Get a chance to add persistent parameters
  100. *
  101. * @param AdminInterface $admin
  102. * @return array
  103. */
  104. public function getPersistentParameters(AdminInterface $admin);
  105. /**
  106. * @param AdminInterface $admin
  107. * @param mixed $object
  108. */
  109. public function preUpdate(AdminInterface $admin, $object);
  110. /**
  111. * @param AdminInterface $admin
  112. * @param mixed $object
  113. */
  114. public function postUpdate(AdminInterface $admin, $object);
  115. /**
  116. * @param AdminInterface $admin
  117. * @param mixed $object
  118. */
  119. public function prePersist(AdminInterface $admin, $object);
  120. /**
  121. * @param AdminInterface $admin
  122. * @param mixed $object
  123. */
  124. public function postPersist(AdminInterface $admin, $object);
  125. /**
  126. * @param AdminInterface $admin
  127. * @param mixed $object
  128. */
  129. public function preRemove(AdminInterface $admin, $object);
  130. /**
  131. * @param AdminInterface $admin
  132. * @param mixed $object
  133. */
  134. public function postRemove(AdminInterface $admin, $object);
  135. }