LocalActionManagerInterface.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Drupal\Core\Menu;
  3. use Drupal\Component\Plugin\PluginManagerInterface;
  4. /**
  5. * Manages discovery and instantiation of menu local action plugins.
  6. *
  7. * Menu local actions are links that lead to actions like "add new". The plugin
  8. * format allows them (if needed) to dynamically generate a title or the path
  9. * they link to. The annotation on the plugin provides the default title,
  10. * and the list of routes where the action should be rendered.
  11. */
  12. interface LocalActionManagerInterface extends PluginManagerInterface {
  13. /**
  14. * Gets the title for a local action.
  15. *
  16. * @param \Drupal\Core\Menu\LocalActionInterface $local_action
  17. * An object to get the title from.
  18. *
  19. * @return string
  20. * The title (already localized).
  21. *
  22. * @throws \BadMethodCallException
  23. * If the plugin does not implement the getTitle() method.
  24. */
  25. public function getTitle(LocalActionInterface $local_action);
  26. /**
  27. * Finds all local actions that appear on a named route.
  28. *
  29. * @param string $route_appears
  30. * The route name for which to find local actions.
  31. *
  32. * @return array
  33. * An array of link render arrays.
  34. */
  35. public function getActionsForRoute($route_appears);
  36. }