function ToolbarController::toolbarAction

Generates the toolbar.

Parameters

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));
}