You are here

public function ServerScopeController::serverAddScope in OAuth2 Server 8

Same name and namespace in other branches
  1. 2.0.x src/Controller/ServerScopeController.php \Drupal\oauth2_server\Controller\ServerScopeController::serverAddScope()

Returns the form for adding a scope to a server.

Parameters

\Drupal\oauth2_server\ServerInterface $oauth2_server: The server the scope should belong to.

Return value

array The renderable form array.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

1 string reference to 'ServerScopeController::serverAddScope'
oauth2_server.routing.yml in ./oauth2_server.routing.yml
oauth2_server.routing.yml

File

src/Controller/ServerScopeController.php, line 55

Class

ServerScopeController
Class Server Scope Controller.

Namespace

Drupal\oauth2_server\Controller

Code

public function serverAddScope(ServerInterface $oauth2_server) {
  $scope = $this
    ->entityTypeManager()
    ->getStorage('oauth2_server_scope')
    ->create([
    'server_id' => $oauth2_server
      ->id(),
  ]);
  return $this
    ->entityFormBuilder()
    ->getForm($scope, 'add', [
    'oauth2_server' => $oauth2_server,
  ]);
}