protected function AutoEntityLabelManager::getAlternativeLabel in Automatic Entity Label 8
Same name and namespace in other branches
- 8.3 src/AutoEntityLabelManager.php \Drupal\auto_entitylabel\AutoEntityLabelManager::getAlternativeLabel()
- 8.2 src/AutoEntityLabelManager.php \Drupal\auto_entitylabel\AutoEntityLabelManager::getAlternativeLabel()
Gets an alternative entity label.
Return value
string Translated label string.
1 call to AutoEntityLabelManager::getAlternativeLabel()
- AutoEntityLabelManager::setLabel in src/
AutoEntityLabelManager.php - Sets the automatically generated entity label.
File
- src/
AutoEntityLabelManager.php, line 280
Class
- AutoEntityLabelManager
- AutoEntityLabelManager class.
Namespace
Drupal\auto_entitylabelCode
protected function getAlternativeLabel() {
$content_type = $this
->getBundleLabel();
if ($this->entity
->id()) {
$label = $this
->t('@type @id', [
'@type' => $content_type,
'@id' => $this->entity
->id(),
]);
}
else {
$label = $content_type;
}
return $label;
}