You are here

protected function EntityMatcher::buildDescription 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::buildDescription()

Builds the description string used in the match array.

Parameters

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

Return value

string The description for this entity.

2 calls to EntityMatcher::buildDescription()
EntityMatcher::getMatches in src/Plugin/Linkit/Matcher/EntityMatcher.php
Gets an array with search matches that will be presented in the autocomplete widget.
FileMatcher::buildDescription in src/Plugin/Linkit/Matcher/FileMatcher.php
Builds the description string used in the match array.
2 methods override EntityMatcher::buildDescription()
FileMatcher::buildDescription in src/Plugin/Linkit/Matcher/FileMatcher.php
Builds the description string used in the match array.
TermMatcher::buildDescription in src/Plugin/Linkit/Matcher/TermMatcher.php
Builds the description string used in the match array.

File

src/Plugin/Linkit/Matcher/EntityMatcher.php, line 307
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 buildDescription($entity) {
  $description = \Drupal::token()
    ->replace($this->configuration['result_description'], [
    $this->target_type => $entity,
  ], []);
  return LinkitXss::descriptionFilter($description);
}