You are here

public function ScopeListBuilder::getDefaultOperations in OAuth2 Server 8

Same name and namespace in other branches
  1. 2.0.x src/ScopeListBuilder.php \Drupal\oauth2_server\ScopeListBuilder::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/ScopeListBuilder.php, line 21

Class

ScopeListBuilder
Builds a listing of oauth2 server entities.

Namespace

Drupal\oauth2_server

Code

public function getDefaultOperations(EntityInterface $entity) {
  $operations = parent::getDefaultOperations($entity);
  if ($entity instanceof ScopeInterface) {
    $route_parameters['oauth2_server'] = $entity
      ->getServer()
      ->id();
    $route_parameters['oauth2_server_scope'] = $entity
      ->id();
    $operations['edit'] = [
      'title' => $this
        ->t('Edit'),
      'weight' => 20,
      'url' => new Url('entity.oauth2_server.scopes.edit_form', $route_parameters),
    ];
    $operations['delete'] = [
      'title' => $this
        ->t('Delete'),
      'weight' => 30,
      'url' => new Url('entity.oauth2_server.scopes.delete_form', $route_parameters),
    ];
  }
  return $operations;
}