You are here

public function ToolbarController::toolbarAction in Devel 8.3

Same name and namespace in other branches
  1. 8 webprofiler/src/Controller/ToolbarController.php \Drupal\webprofiler\Controller\ToolbarController::toolbarAction()
  2. 8.2 webprofiler/src/Controller/ToolbarController.php \Drupal\webprofiler\Controller\ToolbarController::toolbarAction()
  3. 4.x webprofiler/src/Controller/ToolbarController.php \Drupal\webprofiler\Controller\ToolbarController::toolbarAction()

Generates the toolbar.

Parameters

\Symfony\Component\HttpKernel\Profiler\Profile $profile:

Return value

\Symfony\Component\HttpFoundation\Response

Throws

\Exception

1 string reference to 'ToolbarController::toolbarAction'
webprofiler.routing.yml in webprofiler/webprofiler.routing.yml
webprofiler/webprofiler.routing.yml

File

webprofiler/src/Controller/ToolbarController.php, line 69

Class

ToolbarController
Class ToolbarController.

Namespace

Drupal\webprofiler\Controller

Code

public function toolbarAction(Profile $profile) {
  $this->profiler
    ->disable();
  $templates = $this->templateManager
    ->getTemplates($profile);
  $rendered = '';
  foreach ($templates as $name => $template) {
    $rendered .= $template
      ->renderBlock('toolbar', [
      'collector' => $profile
        ->getcollector($name),
      'token' => $profile
        ->getToken(),
      'name' => $name,
    ]);
  }
  $toolbar = [
    '#theme' => 'webprofiler_toolbar',
    '#toolbar' => $rendered,
    '#token' => $profile
      ->getToken(),
  ];
  return new Response($this->renderer
    ->render($toolbar));
}