You are here

protected function EntityMatcher::buildPath in Linkit 8.4

Same name and namespace in other branches
  1. 8.5 src/Plugin/Linkit/Matcher/EntityMatcher.php \Drupal\linkit\Plugin\Linkit\Matcher\EntityMatcher::buildPath()

Builds the path string used in the match array.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The matched entity.

Return value

string The URL for this entity.

1 call to EntityMatcher::buildPath()
EntityMatcher::getMatches in src/Plugin/Linkit/Matcher/EntityMatcher.php
Gets an array with search matches that will be presented in the autocomplete widget.
1 method overrides EntityMatcher::buildPath()
FileMatcher::buildPath in src/Plugin/Linkit/Matcher/FileMatcher.php
The file entity still uses url() even though it's deprecated in the entity interface.

File

src/Plugin/Linkit/Matcher/EntityMatcher.php, line 321
Contains \Drupal\linkit\Plugin\Linkit\Matcher\EntityMatcher.

Class

EntityMatcher
Plugin annotation @Matcher( id = "entity", label = @Translation("Entity"), deriver = "\Drupal\linkit\Plugin\Derivative\EntityMatcherDeriver" )

Namespace

Drupal\linkit\Plugin\Linkit\Matcher

Code

protected function buildPath($entity) {
  return $entity
    ->toUrl()
    ->toString();
}