You are here

DummyMatcher.php in Linkit 8.5

Same filename and directory in other branches
  1. 8.4 tests/linkit_test/src/Plugin/Linkit/Matcher/DummyMatcher.php

File

tests/linkit_test/src/Plugin/Linkit/Matcher/DummyMatcher.php
View source
<?php

namespace Drupal\linkit_test\Plugin\Linkit\Matcher;

use Drupal\linkit\MatcherBase;
use Drupal\linkit\Suggestion\SimpleSuggestion;
use Drupal\linkit\Suggestion\SuggestionCollection;

/**
 * Provides test linkit matchers for the dummy_matcher entity type.
 *
 * @Matcher(
 *   id = "dummy_matcher",
 *   label = @Translation("Dummy Matcher"),
 * )
 */
class DummyMatcher extends MatcherBase {

  /**
   * {@inheritdoc}
   */
  public function execute($string) {
    $suggestions = new SuggestionCollection();
    $suggestion = new SimpleSuggestion();
    $suggestion
      ->setLabel('Dummy Matcher title')
      ->setPath('http://example.com')
      ->setGroup('Dummy Matcher');
    $suggestions
      ->addSuggestion($suggestion);
    return $suggestions;
  }

}

Classes

Namesort descending Description
DummyMatcher Provides test linkit matchers for the dummy_matcher entity type.