You are here

protected function CommerceAutoSkuGeneratorBase::getAlternativeSku in Commerce AutoSKU 8.2

Gets an alternative SKU.

Return value

string Translated label string.

1 call to CommerceAutoSkuGeneratorBase::getAlternativeSku()
CommerceAutoSkuGeneratorBase::generate in src/Plugin/CommerceAutoSkuGenerator/CommerceAutoSkuGeneratorBase.php
Generates the SKU according to the settings.

File

src/Plugin/CommerceAutoSkuGenerator/CommerceAutoSkuGeneratorBase.php, line 91

Class

CommerceAutoSkuGeneratorBase
Places an order through a series of steps.

Namespace

Drupal\commerce_autosku\Plugin\CommerceAutoSkuGenerator

Code

protected function getAlternativeSku(ProductVariationInterface $entity) {
  $content_type = $this
    ->getBundleLabel($entity);
  if ($entity
    ->id()) {
    $label = t('@type @id', array(
      '@type' => $content_type,
      '@id' => $entity
        ->id(),
    ));
  }
  else {
    $label = $content_type;
  }
  return $label;
}