当前位置: 首页>>代码示例>>PHP>>正文


PHP EngineInterface::renderResponse方法代码示例

本文整理汇总了PHP中Symfony\Component\Templating\EngineInterface::renderResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP EngineInterface::renderResponse方法的具体用法?PHP EngineInterface::renderResponse怎么用?PHP EngineInterface::renderResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Templating\EngineInterface的用法示例。


在下文中一共展示了EngineInterface::renderResponse方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onKernelView

 /**
  * @param GetResponseForControllerResultEvent $event
  */
 public function onKernelView(GetResponseForControllerResultEvent $event)
 {
     $request = $event->getRequest();
     $nodeTranslation = $request->attributes->get('_nodeTranslation');
     if ($nodeTranslation) {
         $entity = $request->attributes->get('_entity');
         $url = $request->attributes->get('url');
         $nodeMenu = $request->attributes->get('_nodeMenu');
         $parameters = $request->attributes->get('_renderContext');
         if ($request->get('preview') == true) {
             $version = $request->get('version');
             if (!empty($version) && is_numeric($version)) {
                 $nodeVersion = $this->em->getRepository('KunstmaanNodeBundle:NodeVersion')->find($version);
                 if (!is_null($nodeVersion)) {
                     $entity = $nodeVersion->getRef($this->em);
                 }
             }
         }
         $renderContext = array('nodetranslation' => $nodeTranslation, 'slug' => $url, 'page' => $entity, 'resource' => $entity, 'nodemenu' => $nodeMenu);
         if (is_array($parameters) || $parameters instanceof \ArrayObject) {
             $parameters = array_merge($renderContext, (array) $parameters);
         } else {
             $parameters = $renderContext;
         }
         // Sent the response here, another option is to let the symfony kernel.view listener handle it
         $event->setResponse($this->templating->renderResponse($entity->getDefaultView(), $parameters));
     }
 }
开发者ID:kustov-vitalik,项目名称:KunstmaanBundlesCMS,代码行数:31,代码来源:RenderContextListener.php

示例2: renderResponse

 protected function renderResponse($contentTemplate, $params)
 {
     if ($this->viewHandler) {
         $view = new View($params);
         $view->setTemplate($contentTemplate);
         return $this->viewHandler->handle($view);
     }
     return $this->templating->renderResponse($contentTemplate, $params);
 }
开发者ID:symfony-cmf,项目名称:blog-bundle,代码行数:9,代码来源:BlogController.php

示例3: onKernelView

 /**
  * @param GetResponseForControllerResultEvent $event
  */
 public function onKernelView(GetResponseForControllerResultEvent $event)
 {
     $request = $event->getRequest();
     $nodeTranslation = $request->attributes->get('_nodeTranslation');
     if ($nodeTranslation) {
         $entity = $request->attributes->get('_entity');
         $url = $request->attributes->get('url');
         $nodeMenu = $request->attributes->get('_nodeMenu');
         $parameters = $request->attributes->get('_renderContext');
         $renderContext = array('nodetranslation' => $nodeTranslation, 'slug' => $url, 'page' => $entity, 'resource' => $entity, 'nodemenu' => $nodeMenu);
         if (is_array($parameters) || $parameters instanceof \ArrayObject) {
             $parameters = array_merge($renderContext, (array) $parameters);
         } else {
             $parameters = $renderContext;
         }
         // Sent the response here, another option is to let the symfony kernel.view listener handle it
         $event->setResponse($this->templating->renderResponse($entity->getDefaultView(), $parameters));
     }
 }
开发者ID:headonkeyboard,项目名称:KunstmaanBundlesCMS,代码行数:22,代码来源:RenderContextListener.php

示例4: detailAction

 /**
  *
  * @param Request $request
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function detailAction(Request $request)
 {
     $event = $this->eventManager->findByIdAndLocale($request->get('id'), 'de', true);
     if (!$event) {
         throw new NotFoundHttpException(404);
     }
     $filter['lat'] = $event->getLatitude();
     $filter['long'] = $event->getLongitude();
     $filter['area'] = 100;
     $requestData = $this->requestAnalyzerResolver->resolve($this->requestAnalyzer);
     $resolverData = $this->parameterResolver->resolve(array(), $this->requestAnalyzer, null, false);
     $response = $this->templating->renderResponse('SuluEventBundle:templates:detail.html.twig', array_merge(array('event' => $event, 'urls' => isset($resolverData['urls']) ? $resolverData['urls'] : array()), $requestData));
     $response->setMaxAge($this->cacheMaxAge);
     $response->setSharedMaxAge($this->cacheSharedMaxAge);
     return $response;
 }
开发者ID:bytepark,项目名称:SuluEventBundle,代码行数:22,代码来源:EventWebsiteController.php

示例5: performAction

 /**
  * Launch the background process related to the mass edit action
  *
  * @AclAncestor("pim_enrich_mass_edit")
  *
  * @param Request $request
  * @param string  $operationAlias
  *
  * @throws NotFoundResourceException
  *
  * @return Response
  */
 public function performAction(Request $request, $operationAlias)
 {
     $form = $this->massEditFormResolver->getConfigurationForm($operationAlias);
     $itemsCount = $request->get('itemsCount');
     $configureTemplate = $this->getPerformOperationTemplate($operationAlias);
     $form->remove('operationAlias');
     $form->submit($request);
     $queryParams = $this->getQueryParams($request);
     if ($form->isValid()) {
         $pimFilters = $this->gridFilterAdapter->adapt($request);
         $operation = $form->getData();
         $operation->setFilters($pimFilters);
         $this->operationLauncher->launch($operation);
         $request->getSession()->getFlashBag()->add('success', new Message(sprintf('pim_enrich.mass_edit_action.%s.launched_flash', $operationAlias)));
         $redirectRoute = $this->getPerformOperationRedirectRoute();
         return new RedirectResponse($this->router->generate($redirectRoute, ['dataLocale' => $queryParams['dataLocale']]));
     }
     return $this->templating->renderResponse($configureTemplate, ['form' => $form->createView(), 'operationAlias' => $operationAlias, 'itemsCount' => $itemsCount, 'queryParams' => $queryParams]);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:31,代码来源:AbstractMassEditController.php

示例6: render

 /**
  * Renders a view.
  *
  * @param string   $view       The view name
  * @param array    $parameters An array of parameters to pass to the view
  * @param Response $response   A response instance
  *
  * @return Response A Response instance
  */
 public function render($view, array $parameters = [], Response $response = null)
 {
     return $this->templating->renderResponse($view, $parameters, $response);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:13,代码来源:JobTrackerController.php

示例7: historyAction

 /**
  * History of a group
  *
  * TODO : find a way to use param converter with interfaces
  *
  * @param Group $group
  *
  * @AclAncestor("pim_enrich_group_history")
  *
  * @return Response
  */
 public function historyAction(Group $group)
 {
     return $this->templating->renderResponse('PimEnrichBundle:Group:Tab/_history.html.twig', ['group' => $group]);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:15,代码来源:GroupController.php

示例8: listAction

 public function listAction($page)
 {
     return $this->templating->renderResponse('scene/standalone/list.html.twig', ['scenes' => $this->getScenes($page)]);
 }
开发者ID:szymach,项目名称:talesweaver,代码行数:4,代码来源:StandaloneController.php


注:本文中的Symfony\Component\Templating\EngineInterface::renderResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。