public function CommerceAutoSkuManager::getSkuName in Commerce AutoSKU 8.2
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 CommerceAutoSkuManager::getSkuName()
- CommerceAutoSkuManager::setSku in src/
CommerceAutoSkuManager.php - Sets the automatically generated entity label.
File
- src/
CommerceAutoSkuManager.php, line 180 - Contains \Drupal\commerce_autosku\AutoEntityLabelManager.
Class
Namespace
Drupal\commerce_autoskuCode
public function getSkuName() {
$sku_field = '';
if ($this
->hasSku()) {
$entityManager = \Drupal::service('entity_field.manager');
/** @var BaseFieldDefinition[] $fields */
$fields = $entityManager
->getFieldDefinitions($this->entity
->getEntityTypeId(), $this->entity
->bundle());
$sku_field = $fields['sku']
->getFieldStorageDefinition()
->getName();
}
return $sku_field;
}