You are here

protected function EntityMatcher::createSuggestion in Linkit 8.5

Creates a suggestion.

Parameters

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

Return value

\Drupal\linkit\Suggestion\EntitySuggestion A suggestion object with populated entity data.

1 call to EntityMatcher::createSuggestion()
EntityMatcher::execute in src/Plugin/Linkit/Matcher/EntityMatcher.php
Executes the matcher.

File

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

Class

EntityMatcher
Provides default linkit matchers for all entity types.

Namespace

Drupal\linkit\Plugin\Linkit\Matcher

Code

protected function createSuggestion(EntityInterface $entity) {
  $suggestion = new EntitySuggestion();
  $suggestion
    ->setLabel($this
    ->buildLabel($entity))
    ->setGroup($this
    ->buildGroup($entity))
    ->setDescription($this
    ->buildDescription($entity))
    ->setEntityUuid($entity
    ->uuid())
    ->setEntityTypeId($entity
    ->getEntityTypeId())
    ->setSubstitutionId($this->configuration['substitution_type'])
    ->setPath($this
    ->buildPath($entity));
  return $suggestion;
}