You are here

public function PaymentMethodConfigurationListBuilder::getDefaultOperations in Payment 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 ConfigEntityListBuilder::getDefaultOperations

File

src/Entity/PaymentMethodConfiguration/PaymentMethodConfigurationListBuilder.php, line 102

Class

PaymentMethodConfigurationListBuilder
Lists payment method configurations..

Namespace

Drupal\payment\Entity\PaymentMethodConfiguration

Code

public function getDefaultOperations(EntityInterface $entity) {
  $operations = parent::getDefaultOperations($entity);
  foreach (array(
    'enable',
    'disable',
  ) as $operation) {
    if (!$entity
      ->access($operation)) {
      unset($operations[$operation]);
    }
  }
  if ($entity
    ->access('duplicate')) {
    $operations['duplicate'] = array(
      'title' => $this
        ->t('Duplicate'),
      'weight' => 99,
      'url' => $entity
        ->toUrl('duplicate-form'),
    );
  }
  return $operations;
}