You are here

protected function AutoEntityLabelManager::getAlternativeLabel in Automatic Entity Label 8.2

Same name and namespace in other branches
  1. 8.3 src/AutoEntityLabelManager.php \Drupal\auto_entitylabel\AutoEntityLabelManager::getAlternativeLabel()
  2. 8 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 308

Class

AutoEntityLabelManager
Class for Auto Entity Label Manager.

Namespace

Drupal\auto_entitylabel

Code

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;
}