You are here

public function ServerClientController::serverAddClient in OAuth2 Server 8

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

Returns the form for adding a client to a server.

Parameters

\Drupal\oauth2_server\ServerInterface $oauth2_server: The server the client 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 'ServerClientController::serverAddClient'
oauth2_server.routing.yml in ./oauth2_server.routing.yml
oauth2_server.routing.yml

File

src/Controller/ServerClientController.php, line 56

Class

ServerClientController
Class Server Client Controller.

Namespace

Drupal\oauth2_server\Controller

Code

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