You are here

public function PathautoPatternListBuilder::getDefaultOperations in Pathauto 8

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/PathautoPatternListBuilder.php, line 54

Class

PathautoPatternListBuilder
Provides a listing of Pathauto pattern entities.

Namespace

Drupal\pathauto

Code

public function getDefaultOperations(EntityInterface $entity) {

  /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $entity */
  $operations = parent::getDefaultOperations($entity);
  if (!$entity
    ->hasLinkTemplate('duplicate-form')) {
    return $operations;
  }
  $operations['duplicate'] = [
    'title' => $this
      ->t('Duplicate'),
    'weight' => 0,
    'url' => $this
      ->ensureDestination($entity
      ->toUrl('duplicate-form')),
  ];
  return $operations;
}