public function websiteToolbarAction($locationId = null, $originalSemanticPathInfo = '', Request $request)
    {
        $response = $this->buildResponse();

        if (isset($this->csrfTokenManager)) {
            $parameters['form_token'] = $this->csrfTokenManager->getToken('legacy')->getValue();
        }

        if ($this->previewHelper->isPreviewActive()) {
            $template = 'design:parts/website_toolbar_versionview.tpl';
            $previewedContent = $authValueObject = $this->previewHelper->getPreviewedContent();
            $previewedVersionInfo = $previewedContent->versionInfo;
            $parameters = [
                'object' => $previewedContent,
                'version' => $previewedVersionInfo,
                'language' => $previewedVersionInfo->initialLanguageCode,
                'is_creator' => $previewedVersionInfo->creatorId === $this->getRepository()->getCurrentUser()->id,
            ];
        } elseif ($locationId === null) {
            return $response;
        } else {
            $authValueObject = $this->loadContentByLocationId($locationId);
            $template = 'design:parts/website_toolbar.tpl';
            $parameters = [
                'current_node_id' => $locationId,
                'redirect_uri' => $originalSemanticPathInfo ? $originalSemanticPathInfo : $request->attributes->get('semanticPathinfo'),
            ];
        }

        $authorizationAttribute = new AuthorizationAttribute(
            'websitetoolbar',
            'use',
            ['valueObject' => $authValueObject]
        );

        if (!$this->authChecker->isGranted($authorizationAttribute)) {
            return $response;
        }

        $response->setContent($this->legacyTemplateEngine->render($template, $parameters));

        return $response;
    }
public function websiteToolbarAction($locationId = null, $originalSemanticPathInfo = '', Request $request)
    {
        $response = $this->buildResponse();

        if (isset($this->csrfTokenManager)) {
            $parameters['form_token'] = $this->csrfTokenManager->getToken('legacy')->getValue();
        }

        if ($this->previewHelper->isPreviewActive()) {
            $template = 'design:parts/website_toolbar_versionview.tpl';
            $previewedContent = $authValueObject = $this->previewHelper->getPreviewedContent();
            $previewedVersionInfo = $previewedContent->versionInfo;
            $parameters = [
                'object' => $previewedContent,
                'version' => $previewedVersionInfo,
                'language' => $previewedVersionInfo->initialLanguageCode,
                'is_creator' => $previewedVersionInfo->creatorId === $this->getRepository()->getCurrentUser()->id,
            ];
        } elseif ($locationId === null) {
            return $response;
        } else {
            $authValueObject = $this->loadContentByLocationId($locationId);
            $template = 'design:parts/website_toolbar.tpl';
            $parameters = [
                'current_node_id' => $locationId,
                'redirect_uri' => $originalSemanticPathInfo ? $originalSemanticPathInfo : $request->attributes->get('semanticPathinfo'),
            ];
        }

        $authorizationAttribute = new AuthorizationAttribute(
            'websitetoolbar',
            'use',
            ['valueObject' => $authValueObject]
        );

        if (!$this->authChecker->isGranted($authorizationAttribute)) {
            return $response;
        }

        $response->setContent($this->legacyTemplateEngine->render($template, $parameters));

        return $response;
    }
public function websiteToolbarAction ( $ locationId = null , $ originalSemanticPathInfo = '' , Request $ request ) { $ response = $ this -> buildResponse ( ) ; if ( isset ( $ this -> csrfTokenManager ) ) { $ parameters [ 'form_token' ] = $ this -> csrfTokenManager -> getToken ( 'legacy' ) -> getValue ( ) ; } if ( $ this -> previewHelper -> isPreviewActive ( ) ) { $ template = 'design:parts/website_toolbar_versionview.tpl' ; $ previewedContent = $ authValueObject = $ this -> previewHelper -> getPreviewedContent ( ) ; $ previewedVersionInfo = $ previewedContent -> versionInfo ; $ parameters = [ 'object' => $ previewedContent , 'version' => $ previewedVersionInfo , 'language' => $ previewedVersionInfo -> initialLanguageCode , 'is_creator' => $ previewedVersionInfo -> creatorId === $ this -> getRepository ( ) -> getCurrentUser ( ) -> id , ] ; } elseif ( $ locationId === null ) { return $ response ; } else { $ authValueObject = $ this -> loadContentByLocationId ( $ locationId ) ; $ template = 'design:parts/website_toolbar.tpl' ; $ parameters = [ 'current_node_id' => $ locationId , 'redirect_uri' => $ originalSemanticPathInfo ? $ originalSemanticPathInfo : $ request -> attributes -> get ( 'semanticPathinfo' ) , ] ; } $ authorizationAttribute = new AuthorizationAttribute ( 'websitetoolbar' , 'use' , [ 'valueObject' => $ authValueObject ] ) ; if ( ! $ this -> authChecker -> isGranted ( $ authorizationAttribute ) ) { return $ response ; } $ response -> setContent ( $ this -> legacyTemplateEngine -> render ( $ template , $ parameters ) ) ; return $ response ; }
Renders the legacy website toolbar template.

If the logged in user doesn't have the required permission, an empty response is returned

@param mixed $locationId
@param Request $request

@return Response
Renders the legacy website toolbar template .