You are here

public function ServerListBuilder::getDefaultOperations in OAuth2 Server 8

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

Class

ServerListBuilder
Builds a listing of oauth2 server entities.

Namespace

Drupal\oauth2_server

Code

public function getDefaultOperations(EntityInterface $entity) {
  $operations = parent::getDefaultOperations($entity);
  if ($entity instanceof ServerInterface) {
    $route_parameters['oauth2_server'] = $entity
      ->id();
    $operations['scopes'] = [
      'title' => $this
        ->t('Scopes'),
      'weight' => 20,
      'url' => new Url('entity.oauth2_server.scopes', $route_parameters),
    ];
    $operations['clients'] = [
      'title' => $this
        ->t('Clients'),
      'weight' => 20,
      'url' => new Url('entity.oauth2_server.clients', $route_parameters),
    ];
  }
  return $operations;
}