public function ConfigurableDummyMatcher::getMatches in Linkit 8.4
Gets an array with search matches that will be presented in the autocomplete widget.
Parameters
$string: The string that contains the text to search for.
Return value
array An array whose values are an associative array containing:
- title: A string to use as the search result label.
- description: (optional) A string with additional information about the result item.
- path: The URL to the item.
- group: (optional) A string with the group name for the result item. Best practice is to use the plugin name as group name.
Overrides MatcherInterface::getMatches
File
- tests/
linkit_test/ src/ Plugin/ Linkit/ Matcher/ ConfigurableDummyMatcher.php, line 72 - Contains \Drupal\linkit_test\Plugin\Linkit\Matcher\ConfigurableDummyMatcher.
Class
- ConfigurableDummyMatcher
- Plugin annotation @Matcher( id = "configurable_dummy_matcher", label = @Translation("Configurable Dummy Matcher"), )
Namespace
Drupal\linkit_test\Plugin\Linkit\MatcherCode
public function getMatches($string) {
$matches[] = [
'title' => 'Configurable Dummy Matcher title',
'description' => 'Configurable Dummy Matcher description',
'path' => 'http://example.com',
'group' => 'Configurable Dummy Matcher',
];
return $matches;
}