You are here

public function BulkVariationsCreator::getNotUsedAttributesCombination in Commerce Bulk 8

Gets first not used combination on a product.

Parameters

array $variations: The commerce product variations.

Return value

array|null a number of possible and duplicated and used combinations, last variation, number of duplicated combinations and an HTML list of duplicated variations labels if they are found:

  • "last_variation": The variation on the last inline entity form array.
  • "count": The quantity of the combinations.
  • "duplicated": The number of duplicated combinations.
  • "used": The number of used combinations.
  • "duplications_list": HTML list of duplicated combinations if present.
  • "not_used_combination": The first not used attributes combination.

Overrides BulkVariationsCreatorInterface::getNotUsedAttributesCombination

1 call to BulkVariationsCreator::getNotUsedAttributesCombination()
BulkVariationsCreator::getIefFormNotUsedAttributesCombination in src/BulkVariationsCreator.php
Gets first not used combination on a product IEF form.

File

src/BulkVariationsCreator.php, line 309

Class

BulkVariationsCreator
Default implementation of the BulkVariationsCreatorInterface.

Namespace

Drupal\commerce_bulk

Code

public function getNotUsedAttributesCombination(array $variations) {
  if (!($all = $this
    ->getDuplicationsHtmlList($variations))) {
    return;
  }
  $all['not_used_combination'] = reset($all['not_used_combinations']);

  // Rid of unecessary data which might be quite heavy.
  unset($all['used_combinations'], $all['not_used_combinations']);
  return $all;
}