protected function EntityMatcher::buildGroup in Linkit 8.5
Same name and namespace in other branches
- 8.4 src/Plugin/Linkit/Matcher/EntityMatcher.php \Drupal\linkit\Plugin\Linkit\Matcher\EntityMatcher::buildGroup()
Builds the group string used in the suggestion.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The matched entity.
Return value
string The match group for this entity.
File
- src/
Plugin/ Linkit/ Matcher/ EntityMatcher.php, line 470
Class
- EntityMatcher
- Provides default linkit matchers for all entity types.
Namespace
Drupal\linkit\Plugin\Linkit\MatcherCode
protected function buildGroup(EntityInterface $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->entityTypeBundleInfo
->getBundleInfo($entity
->getEntityTypeId());
$bundle_label = $bundles[$entity
->bundle()]['label'];
$group .= ' - ' . $bundle_label;
}
return $group;
}