You are here

public function AutoEntityLabelManager::getLabelName in Automatic Entity Label 8.2

Same name and namespace in other branches
  1. 8.3 src/AutoEntityLabelManager.php \Drupal\auto_entitylabel\AutoEntityLabelManager::getLabelName()
  2. 8 src/AutoEntityLabelManager.php \Drupal\auto_entitylabel\AutoEntityLabelManager::getLabelName()

Gets the field name of the entity label.

Return value

string The entity label field name. Empty if the entity has no label.

1 call to AutoEntityLabelManager::getLabelName()
AutoEntityLabelManager::setLabel in src/AutoEntityLabelManager.php
Sets the automatically generated entity label.

File

src/AutoEntityLabelManager.php, line 204

Class

AutoEntityLabelManager
Class for Auto Entity Label Manager.

Namespace

Drupal\auto_entitylabel

Code

public function getLabelName() {
  $label_field = '';
  if ($this
    ->hasLabel()) {
    $definition = $this->entityTypeManager
      ->getDefinition($this->entity
      ->getEntityTypeId());
    $label_field = $definition
      ->getKey('label');
  }
  return $label_field;
}