public function widget(Request $request, $key)
    {
        if (!$widget = $this->app['asset.queue.widget']->get($key)) {
            return $this->abort(Response::HTTP_NOT_FOUND);
        }

        $authCookie = $request->cookies->get($this->app['token.authentication.name']);
        if ($widget->getZone() !== 'frontend' && !$this->accessControl()->isValidSession($authCookie)) {
            $this->abort(Response::HTTP_UNAUTHORIZED, 'You must be logged in to use this.');
        }

        $html = $this->app['asset.queue.widget']->getRendered($key);
        $response = new Response($html);

        return $response;
    }
public function widget(Request $request, $key)
    {
        if (!$widget = $this->app['asset.queue.widget']->get($key)) {
            return $this->abort(Response::HTTP_NOT_FOUND);
        }

        $authCookie = $request->cookies->get($this->app['token.authentication.name']);
        if ($widget->getZone() !== 'frontend' && !$this->accessControl()->isValidSession($authCookie)) {
            $this->abort(Response::HTTP_UNAUTHORIZED, 'You must be logged in to use this.');
        }

        $html = $this->app['asset.queue.widget']->getRendered($key);
        $response = new Response($html);

        return $response;
    }
public function widget ( Request $ request , $ key ) { if ( ! $ widget = $ this -> app [ 'asset.queue.widget' ] -> get ( $ key ) ) { return $ this -> abort ( Response :: HTTP_NOT_FOUND ) ; } $ authCookie = $ request -> cookies -> get ( $ this -> app [ 'token.authentication.name' ] ) ; if ( $ widget -> getZone ( ) !== 'frontend' && ! $ this -> accessControl ( ) -> isValidSession ( $ authCookie ) ) { $ this -> abort ( Response :: HTTP_UNAUTHORIZED , 'You must be logged in to use this.' ) ; } $ html = $ this -> app [ 'asset.queue.widget' ] -> getRendered ( $ key ) ; $ response = new Response ( $ html ) ; return $ response ; }
Render a widget, and return the HTML, so it can be inserted in the page.

@param Request $request
@param string  $key

@return Response
Render a widget and return the HTML so it can be inserted in the page .