LocalActionInterface.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace Drupal\Core\Menu;
  3. use Drupal\Core\Routing\RouteMatchInterface;
  4. /**
  5. * Defines an interface for menu local actions.
  6. */
  7. interface LocalActionInterface {
  8. /**
  9. * Get the route name from the settings.
  10. *
  11. * @return string
  12. * The name of the route this action links to.
  13. */
  14. public function getRouteName();
  15. /**
  16. * Returns the route parameters needed to render a link for the local action.
  17. *
  18. * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
  19. * The current route match.
  20. *
  21. * @return array
  22. * An array of parameter names and values.
  23. */
  24. public function getRouteParameters(RouteMatchInterface $route_match);
  25. /**
  26. * Returns the weight for the local action.
  27. *
  28. * @return int
  29. */
  30. public function getWeight();
  31. /**
  32. * Returns options for rendering a link for the local action.
  33. *
  34. * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
  35. * The current route match.
  36. *
  37. * @return array
  38. * An associative array of options.
  39. */
  40. public function getOptions(RouteMatchInterface $route_match);
  41. /**
  42. * Returns the localized title to be shown for this action.
  43. *
  44. * Subclasses may add optional arguments like NodeInterface $node = NULL that
  45. * will be supplied by the ControllerResolver.
  46. *
  47. * @return string
  48. * The title to be shown for this action.
  49. *
  50. * @see \Drupal\Core\Menu\LocalActionManager::getTitle()
  51. */
  52. public function getTitle();
  53. }