MatcherInterface.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * @file
  4. * Contains \Drupal\linkit\MatcherInterface.
  5. */
  6. namespace Drupal\linkit;
  7. use Drupal\Component\Plugin\ConfigurablePluginInterface;
  8. use Drupal\Component\Plugin\PluginInspectionInterface;
  9. use Drupal\Core\Plugin\PluginFormInterface;
  10. /**
  11. * Defines the interface for matchers.
  12. *
  13. * @see \Drupal\linkit\Annotation\Matcher
  14. * @see \Drupal\linkit\MatcherBase
  15. * @see \Drupal\linkit\MatcherManager
  16. * @see plugin_api
  17. */
  18. interface MatcherInterface extends PluginInspectionInterface, ConfigurablePluginInterface {
  19. /**
  20. * Returns the unique ID representing the matcher.
  21. *
  22. * @return string
  23. * The matcher ID.
  24. */
  25. public function getUuid();
  26. /**
  27. * Returns the matcher label.
  28. *
  29. * @return string
  30. * The matcher label.
  31. */
  32. public function getLabel();
  33. /**
  34. * Returns the summarized configuration of the matcher.
  35. *
  36. * @return array
  37. * An array of summarized configuration of the matcher.
  38. */
  39. public function getSummary();
  40. /**
  41. * Returns the weight of the matcher.
  42. *
  43. * @return int|string
  44. * Either the integer weight of the matcher, or an empty string.
  45. */
  46. public function getWeight();
  47. /**
  48. * Sets the weight for the matcher.
  49. *
  50. * @param int $weight
  51. * The weight for this matcher.
  52. *
  53. * @return $this
  54. */
  55. public function setWeight($weight);
  56. /**
  57. * Gets an array with search matches that will be presented in the autocomplete
  58. * widget.
  59. *
  60. * @param $string
  61. * The string that contains the text to search for.
  62. *
  63. * @return array
  64. * An array whose values are an associative array containing:
  65. * - title: A string to use as the search result label.
  66. * - description: (optional) A string with additional information about the
  67. * result item.
  68. * - path: The URL to the item.
  69. * - group: (optional) A string with the group name for the result item.
  70. * Best practice is to use the plugin name as group name.
  71. */
  72. public function getMatches($string);
  73. }