You are here

public function AutoEntityLabelManager::getLabelName in Automatic Entity Label 8

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

Class

AutoEntityLabelManager
AutoEntityLabelManager class.

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