StaticMenuLinkOverridesInterface.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. namespace Drupal\Core\Menu;
  3. /**
  4. * Defines an interface for objects which overrides menu links defined in YAML.
  5. */
  6. interface StaticMenuLinkOverridesInterface {
  7. /**
  8. * Reloads the overrides from config.
  9. *
  10. * Forces all overrides to be reloaded from config storage to compare the
  11. * override value with the value submitted during test form submission.
  12. */
  13. public function reload();
  14. /**
  15. * Loads any overrides to the definition of a static (YAML-defined) link.
  16. *
  17. * @param string $id
  18. * A menu link plugin ID.
  19. *
  20. * @return array|null
  21. * An override with following supported keys:
  22. * - parent
  23. * - weight
  24. * - menu_name
  25. * - expanded
  26. * - enabled
  27. * or NULL if there is no override for the given ID.
  28. */
  29. public function loadOverride($id);
  30. /**
  31. * Deletes any overrides to the definition of a static (YAML-defined) link.
  32. *
  33. * @param string $id
  34. * A menu link plugin ID.
  35. */
  36. public function deleteOverride($id);
  37. /**
  38. * Deletes multiple overrides to definitions of static (YAML-defined) links.
  39. *
  40. * @param array $ids
  41. * Array of menu link plugin IDs.
  42. */
  43. public function deleteMultipleOverrides(array $ids);
  44. /**
  45. * Loads overrides to multiple definitions of a static (YAML-defined) link.
  46. *
  47. * @param array $ids
  48. * Array of menu link plugin IDs.
  49. *
  50. * @return array
  51. * One or override keys by plugin ID.
  52. *
  53. * @see \Drupal\Core\Menu\StaticMenuLinkOverridesInterface
  54. */
  55. public function loadMultipleOverrides(array $ids);
  56. /**
  57. * Saves the override.
  58. *
  59. * @param string $id
  60. * A menu link plugin ID.
  61. * @param array $definition
  62. * The definition values to override. Supported keys:
  63. * - menu_name
  64. * - parent
  65. * - weight
  66. * - expanded
  67. * - enabled
  68. *
  69. * @return array
  70. * A list of properties which got saved.
  71. */
  72. public function saveOverride($id, array $definition);
  73. /**
  74. * The unique cache tag associated with this menu link override.
  75. *
  76. * @return string[]
  77. * An array of cache tags.
  78. */
  79. public function getCacheTags();
  80. }