You are here

protected function AccessTokenController::buildResponse in Access unpublished 8

Builds a response object.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request object.

\Drupal\access_unpublished\Entity\AccessToken $access_token: The access token to delete.

Return value

\Drupal\Core\Ajax\AjaxResponse A replace command to replace the token table.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

2 calls to AccessTokenController::buildResponse()
AccessTokenController::delete in src/Controller/AccessTokenController.php
Deletes an access token.
AccessTokenController::renew in src/Controller/AccessTokenController.php
Renews an access token.

File

src/Controller/AccessTokenController.php, line 106

Class

AccessTokenController
Controller for the access token handling.

Namespace

Drupal\access_unpublished\Controller

Code

protected function buildResponse(Request $request, AccessToken $access_token) {
  $handler_name = $request->query
    ->has('handler') ? $request->query
    ->get('handler') : 'list_builder';

  /** @var \Drupal\Core\Entity\EntityListBuilder $list_builder */
  $list_builder = $this
    ->entityTypeManager()
    ->getHandler('access_token', $handler_name);
  $form = $list_builder
    ->render($access_token
    ->getHost());
  $response = new AjaxResponse();
  $response
    ->addCommand(new ReplaceCommand('[data-drupal-selector="access-token-list"]', $form['table']));
  return $response;
}