BreadcrumbsBuilderInterface.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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;
  12. /**
  13. * Builds a breacrumbs. There is a dependency on the AdminInterface because
  14. * this object holds useful object to deal with this task, but there is
  15. * probably a better design.
  16. *
  17. * @author Grégoire Paris <postmaster@greg0ire.fr>
  18. */
  19. interface BreadcrumbsBuilderInterface
  20. {
  21. /**
  22. * Get breadcrumbs for $action.
  23. *
  24. * @param AdminInterface $admin
  25. * @param string $action the name of the action we want to get a
  26. * breadcrumbs for
  27. *
  28. * @return mixed array|Traversable the breadcrumbs
  29. */
  30. public function getBreadcrumbs(AdminInterface $admin, $action);
  31. /**
  32. * Builds breadcrumbs for $action, starting from $menu.
  33. *
  34. * Note: the method will be called by the top admin instance (parent => child)
  35. * NEXT_MAJOR : remove this method from the public interface.
  36. *
  37. * @param AdminInterface $admin
  38. * @param string $action
  39. * @param ItemInterface|null $menu
  40. */
  41. public function buildBreadcrumbs(
  42. AdminInterface $admin,
  43. $action,
  44. ItemInterface $menu = null
  45. );
  46. }