You are here

protected function EntityMatcher::buildDescription in Linkit 8.5

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

Builds the metadata string used in the suggestion.

Parameters

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

Return value

string The metadata for this entity.

1 call to EntityMatcher::buildDescription()
FileMatcher::buildDescription in src/Plugin/Linkit/Matcher/FileMatcher.php
Builds the metadata string used in the suggestion.
2 methods override EntityMatcher::buildDescription()
FileMatcher::buildDescription in src/Plugin/Linkit/Matcher/FileMatcher.php
Builds the metadata string used in the suggestion.
TermMatcher::buildDescription in src/Plugin/Linkit/Matcher/TermMatcher.php
Builds the metadata string used in the suggestion.

File

src/Plugin/Linkit/Matcher/EntityMatcher.php, line 456

Class

EntityMatcher
Provides default linkit matchers for all entity types.

Namespace

Drupal\linkit\Plugin\Linkit\Matcher

Code

protected function buildDescription(EntityInterface $entity) {
  $description = \Drupal::token()
    ->replace($this->configuration['metadata'], [
    $this->targetType => $entity,
  ], [
    'clear' => TRUE,
  ]);
  return LinkitXss::descriptionFilter($description);
}