You are here

protected function ProductVariationListBuilder::getDefaultOperations in Commerce Core 8.2

Gets this list's default operations.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity the operations are for.

Return value

array The array structure is identical to the return value of self::getOperations().

Overrides EntityListBuilder::getDefaultOperations

File

modules/product/src/ProductVariationListBuilder.php, line 252

Class

ProductVariationListBuilder
Defines the list builder for product variations.

Namespace

Drupal\commerce_product

Code

protected function getDefaultOperations(EntityInterface $entity) {
  $operations = parent::getDefaultOperations($entity);
  if ($entity
    ->access('create') && $entity
    ->hasLinkTemplate('duplicate-form')) {
    $operations['duplicate'] = [
      'title' => $this
        ->t('Duplicate'),
      'weight' => 20,
      'url' => $this
        ->ensureDestination($entity
        ->toUrl('duplicate-form')),
    ];
  }
  return $operations;
}