ContextualLinkManagerInterface.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace Drupal\Core\Menu;
  3. /**
  4. * Provides an object which returns the available contextual links.
  5. */
  6. interface ContextualLinkManagerInterface {
  7. /**
  8. * Gets the contextual link plugins by contextual link group.
  9. *
  10. * @param string $group_name
  11. * The group name.
  12. *
  13. * @return array
  14. * A list of contextual links plugin definitions.
  15. */
  16. public function getContextualLinkPluginsByGroup($group_name);
  17. /**
  18. * Gets the contextual links prepared as expected by links.html.twig.
  19. *
  20. * @param string $group_name
  21. * The group name.
  22. * @param array $route_parameters
  23. * The incoming route parameters. The route parameters need to have the same
  24. * name on all contextual link routes, e.g. you cannot use 'node' and
  25. * 'entity' in parallel.
  26. * @param array $metadata
  27. * Additional metadata of contextual links, like the position (optional).
  28. *
  29. * @return array
  30. * An array of link information, keyed by the plugin ID. Each entry is an
  31. * associative array with the following keys:
  32. * - route_name: The route name to link to.
  33. * - route_parameters: The route parameters for the contextual link.
  34. * - title: The title of the contextual link.
  35. * - weight: The weight of the contextual link.
  36. * - localized_options: The options of the link, which will be passed
  37. * to the link generator.
  38. * - metadata: The array of additional metadata that was passed in.
  39. */
  40. public function getContextualLinksArrayByGroup($group_name, array $route_parameters, array $metadata = []);
  41. }