You are here

public function CommerceAutoSkuManager::autoSkuNeeded in Commerce AutoSKU 8.2

Returns whether the automatic label has to be set.

Return value

bool Returns true if the label should be automatically generated.

Overrides CommerceAutoSkuManagerInterface::autoSkuNeeded

File

src/CommerceAutoSkuManager.php, line 167
Contains \Drupal\commerce_autosku\AutoEntityLabelManager.

Class

CommerceAutoSkuManager

Namespace

Drupal\commerce_autosku

Code

public function autoSkuNeeded() {
  $not_applied = empty($this->auto_sku_applied);
  $required = $this
    ->hasAutoSku() && $this->entity
    ->getSku() == '%AutoSku%';
  $optional = $this
    ->hasOptionalAutoSku() && empty($this->entity
    ->getSku());
  return $not_applied && ($required || $optional);
}