You are here

public function AssetInjectorListBuilder::getDefaultOperations in Asset Injector 8

Same name and namespace in other branches
  1. 8.2 src/AssetInjectorListBuilder.php \Drupal\asset_injector\AssetInjectorListBuilder::getDefaultOperations()

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 ConfigEntityListBuilder::getDefaultOperations

File

src/AssetInjectorListBuilder.php, line 47

Class

AssetInjectorListBuilder
Provides a listing of Asset Injector entities.

Namespace

Drupal\asset_injector

Code

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