public static function BulkVariationsCreator::getAutoSku in Commerce Bulk 8
Default value callback for the 'sku' base field definition.
Parameters
\Drupal\commerce_product\Entity\ProductVariation $variation: The commerce product variation.
Return value
string An optionally prefixed/suffixed unique identifier based on settings of the widget of the field and current time in microseconds.
Overrides BulkVariationsCreatorInterface::getAutoSku
See also
\Drupal\commerce_product\Entity\ProductVariation::baseFieldDefinitions()
http://php.net/manual/en/function.uniqid.php
1 call to BulkVariationsCreator::getAutoSku()
- BulkVariationsCreator::createProductVariation in src/
BulkVariationsCreator.php - Creates a variation for commerce_product.
File
- src/
BulkVariationsCreator.php, line 68
Class
- BulkVariationsCreator
- Default implementation of the BulkVariationsCreatorInterface.
Namespace
Drupal\commerce_bulkCode
public static function getAutoSku(ProductVariation $variation) {
extract(static::getSkuSettings($variation));
// Do return empty string in case of StringTextfieldWidget.
return isset($uniqid_enabled) ? $uniqid_enabled ? \uniqid($prefix, $more_entropy) . $suffix : "{$prefix}{$suffix}" : '';
}