You are here

public function AutoEntityLabelManager::hasLabel in Automatic Entity Label 8.2

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

Checks if the entity has a label.

Return value

bool True if the entity has a label property.

2 calls to AutoEntityLabelManager::hasLabel()
AutoEntityLabelManager::getLabelName in src/AutoEntityLabelManager.php
Gets the field name of the entity label.
AutoEntityLabelManager::setLabel in src/AutoEntityLabelManager.php
Sets the automatically generated entity label.

File

src/AutoEntityLabelManager.php, line 126

Class

AutoEntityLabelManager
Class for Auto Entity Label Manager.

Namespace

Drupal\auto_entitylabel

Code

public function hasLabel() {

  /** @var \Drupal\Core\Entity\EntityTypeInterface $definition */
  $definition = $this->entityTypeManager
    ->getDefinition($this->entity
    ->getEntityTypeId());
  return $definition
    ->hasKey('label');
}