You are here

protected function EntityFormAccessTokenListBuilder::getDefaultOperations in Access unpublished 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 AccessTokenListBuilder::getDefaultOperations

File

src/EntityFormAccessTokenListBuilder.php, line 62

Class

EntityFormAccessTokenListBuilder
Defines a class to build a listing of access token entities.

Namespace

Drupal\access_unpublished

Code

protected function getDefaultOperations(EntityInterface $token) {

  /** @var \Drupal\access_unpublished\AccessTokenInterface $token */
  $operations = parent::getDefaultOperations($token);
  if (isset($operations['copy'])) {
    $url = $this->accessTokenManager
      ->getAccessTokenUrl($token, $this->contentEntity
      ->language());
    $operations['copy'] = [
      'title' => $this
        ->t('Copy'),
      'url' => Url::fromUserInput('#'),
      'attributes' => [
        'data-unpublished-access-url' => $url,
        'class' => [
          'clipboard-button',
        ],
      ],
      'weight' => 50,
    ];
  }
  return $operations;
}