CategorizingPluginManagerInterface.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace Drupal\Component\Plugin;
  3. /**
  4. * Defines an interface for plugin managers that categorize plugin definitions.
  5. */
  6. interface CategorizingPluginManagerInterface extends PluginManagerInterface {
  7. /**
  8. * Gets the names of all categories.
  9. *
  10. * @return string[]
  11. * An array of translated categories, sorted alphabetically.
  12. */
  13. public function getCategories();
  14. /**
  15. * Gets sorted plugin definitions.
  16. *
  17. * @param array[]|null $definitions
  18. * (optional) The plugin definitions to sort. If omitted, all plugin
  19. * definitions are used.
  20. *
  21. * @return array[]
  22. * An array of plugin definitions, sorted by category and label.
  23. */
  24. public function getSortedDefinitions(array $definitions = NULL);
  25. /**
  26. * Gets sorted plugin definitions grouped by category.
  27. *
  28. * In addition to grouping, both categories and its entries are sorted,
  29. * whereas plugin definitions are sorted by label.
  30. *
  31. * @param array[]|null $definitions
  32. * (optional) The plugin definitions to group. If omitted, all plugin
  33. * definitions are used.
  34. *
  35. * @return array[]
  36. * Keys are category names, and values are arrays of which the keys are
  37. * plugin IDs and the values are plugin definitions.
  38. */
  39. public function getGroupedDefinitions(array $definitions = NULL);
  40. }