protected function EntityMatcher::buildGroup in Linkit 8.4
Same name and namespace in other branches
- 8.5 src/Plugin/Linkit/Matcher/EntityMatcher.php \Drupal\linkit\Plugin\Linkit\Matcher\EntityMatcher::buildGroup()
Builds the group string used in the match array.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The matched entity.
Return value
string The match group for this entity.
1 call to EntityMatcher::buildGroup()
- EntityMatcher::getMatches in src/
Plugin/ Linkit/ Matcher/ EntityMatcher.php - Gets an array with search matches that will be presented in the autocomplete widget.
File
- src/
Plugin/ Linkit/ Matcher/ EntityMatcher.php, line 334 - 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\MatcherCode
protected function buildGroup($entity) {
$group = $entity
->getEntityType()
->getLabel();
// If the entities by this entity should be grouped by bundle, get the
// name and append it to the group.
if ($this->configuration['group_by_bundle']) {
$bundles = $this->entityManager
->getBundleInfo($entity
->getEntityTypeId());
$bundle_label = $bundles[$entity
->bundle()]['label'];
$group .= ' - ' . $bundle_label;
}
return $group;
}