本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Templating\EngineInterface::renderResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP EngineInterface::renderResponse方法的具体用法?PHP EngineInterface::renderResponse怎么用?PHP EngineInterface::renderResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Bundle\FrameworkBundle\Templating\EngineInterface
的用法示例。
在下文中一共展示了EngineInterface::renderResponse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onResponse
/**
* Checking request and response and decide whether we need a redirect
*
* @param FilterResponseEvent $event
*/
public function onResponse(FilterResponseEvent $event)
{
$request = $event->getRequest();
$response = $event->getResponse();
if ($request->get(self::HASH_NAVIGATION_HEADER) || $request->headers->get(self::HASH_NAVIGATION_HEADER)) {
$location = '';
$isFullRedirect = false;
if ($response->isRedirect()) {
$location = $response->headers->get('location');
if ($request->attributes->get('_fullRedirect') || !is_object($this->security->getToken())) {
$isFullRedirect = true;
}
}
if ($response->isNotFound() || $response->getStatusCode() == 503 && !$this->isDebug) {
$location = $request->getUri();
$isFullRedirect = true;
}
if ($location) {
$response = $this->templating->renderResponse('OroNavigationBundle:HashNav:redirect.html.twig', array('full_redirect' => $isFullRedirect, 'location' => $location));
}
// disable cache for ajax navigation pages and change content type to json
$response->headers->set('Content-Type', 'application/json');
$response->headers->addCacheControlDirective('no-cache', true);
$response->headers->addCacheControlDirective('max-age', 0);
$response->headers->addCacheControlDirective('must-revalidate', true);
$response->headers->addCacheControlDirective('no-store', true);
$event->setResponse($response);
}
}
示例2: associationsAction
/**
* Display association grids
*
* @param Request $request the request
* @param integer $id the product id (owner)
*
* @AclAncestor("pim_enrich_associations_view")
*
* @return Response
*/
public function associationsAction(Request $request, $id)
{
$product = $this->findProductOr404($id);
$this->productManager->ensureAllAssociationTypes($product);
$associationTypes = $this->doctrine->getRepository('PimCatalogBundle:AssociationType')->findAll();
return $this->templating->renderResponse('PimEnrichBundle:Association:_associations.html.twig', array('product' => $product, 'associationTypes' => $associationTypes, 'dataLocale' => $request->get('dataLocale', null)));
}
示例3: indexAction
public function indexAction(Request $request, $configurationId)
{
$configuration = $this->getConfigurationOr404($configurationId);
$pagination = $this->createPagination($configuration, $request);
$reports = $this->reportManager->getJobReportsByConfiguration($configuration, $pagination->getOffset(), $pagination->getPerPage());
return $this->templating->renderResponse('AurejaJobQueueBundle:JobReport:index.html.twig', ['configuration' => $this->getConfigurationOr404($configurationId), 'pagination' => $pagination, 'reports' => $reports]);
}
示例4: onCoreRequest
/**
* @param GetResponseEvent $event
*/
public function onCoreRequest(GetResponseEvent $event)
{
if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
return;
}
$token = $this->securityContext->getToken();
if (!$token) {
return;
}
if (!$token instanceof UsernamePasswordToken) {
return;
}
$key = $this->helper->getSessionKey($this->securityContext->getToken());
$request = $event->getRequest();
$session = $event->getRequest()->getSession();
$user = $this->securityContext->getToken()->getUser();
if (!$session->has($key)) {
return;
}
if ($session->get($key) === true) {
return;
}
$state = 'init';
if ($request->getMethod() == 'POST') {
if ($this->helper->checkCode($user, $request->get('_code')) == true) {
$session->set($key, true);
return;
}
$state = 'error';
}
$event->setResponse($this->templating->renderResponse('SonataUserBundle:Admin:Security/two_step_form.html.twig', array('state' => $state)));
}
示例5: loginAction
public function loginAction(Request $request)
{
$form = $this->formFactory->create(LoginType::class);
if ($error = $this->getAuthenticationError($request)) {
$form->addError(new FormError($error->getMessage()));
}
return $this->templating->renderResponse('Security/login.html.twig', ['form' => $form->createView()]);
}
示例6: details
public function details($token, $requestIndex)
{
$this->profiler->disable();
$profile = $this->profiler->loadProfile($token);
$logs = $profile->getCollector('contentful')->getLogs();
$logEntry = $logs[$requestIndex];
return $this->templating->renderResponse('@Contentful/Collector/details.html.twig', ['requestIndex' => $requestIndex, 'entry' => $logEntry]);
}
示例7: modalAction
public function modalAction(Request $request)
{
$image = null;
if (null !== ($filename = $request->get('filename', null))) {
$image = $this->imageManager->findByFilename($filename);
}
return $this->templating->renderResponse('SilvestraMediaBundle:Form:modal.html.twig', array('image' => $image));
}
示例8: completenessAction
/**
* Displays completeness for a product
*
* @param int $id
*
* @return Response
*/
public function completenessAction($id)
{
$product = $this->productManager->getProductRepository()->getFullProduct($id);
$channels = $this->channelManager->getFullChannels();
$locales = $this->userContext->getUserLocales();
$completenesses = $this->completenessManager->getProductCompleteness($product, $channels, $locales, $this->userContext->getCurrentLocale()->getCode());
return $this->templating->renderResponse('PimEnrichBundle:Completeness:_completeness.html.twig', array('product' => $product, 'channels' => $channels, 'locales' => $locales, 'completenesses' => $completenesses));
}
示例9: onJobCreated
/**
* @param JobEvent $jobEvent
*/
public function onJobCreated(JobEvent $jobEvent)
{
$job = $jobEvent->getJob();
// Notification message to User
$this->jobBoardMailer->sendMessage(sprintf('The job %s has been Sent', $job->getTitle()), 'no-reply@hossamyoussef.com', $job->getEmail(), $this->templating->renderResponse('Email/user.html.twig', array('job' => $job)));
// Notification message to Job-Board Moderator
$this->jobBoardMailer->sendMessage(sprintf('The job %s has been created', $job->getTitle()), 'no-reply@hossamyoussef.com', 'admin@hossamyoussef.com', $this->templating->renderResponse('Email/moderator.html.twig', array('job' => $job)));
}
示例10: createAction
public function createAction()
{
$productFromAdmin = new ProductFromAdmin();
$productData = Product::instantiateFromAdmin($productFromAdmin);
// $productData = new ProductFromAdmin();
// $productData->name = 'Wat NU?';
return $this->templateEngine->renderResponse('AppBundle:admin:productStore.html.twig', array('product' => $productData));
}
示例11: render
/**
* {@inheritdoc}
*/
public function render(ReportInterface $report, Data $data)
{
if (null !== $data->getData()) {
$data = array('report' => $report, 'values' => $data->getData(), 'labels' => $data->getLabels(), 'fields' => array_keys($data->getData()));
$rendererConfiguration = $report->getRendererConfiguration();
return $this->templating->renderResponse($rendererConfiguration["template"], array('data' => $data, 'configuration' => $rendererConfiguration));
}
return $this->templating->renderResponse("SyliusReportBundle::noDataTemplate.html.twig", array('report' => $report));
}
示例12: itemAction
public function itemAction($id)
{
try {
$item = $this->manager->getItem($id);
} catch (NotFoundException $e) {
throw new NotFoundHttpException($e->getMessage());
}
return $this->templating->renderResponse($this->templateItem, ['item' => $item]);
}
示例13: indexAction
/**
* @param Request $request
*
* @return Response
*/
public function indexAction(Request $request)
{
$channelCode = $request->query->get('channel');
/** @var ChannelInterface $channel */
$channel = $this->findChannelByCodeOrFindFirst($channelCode);
if (null === $channel) {
return new RedirectResponse($this->router->generate('sylius_admin_channel_create'));
}
$statistics = $this->statisticsProvider->getStatisticsForChannel($channel);
return $this->templatingEngine->renderResponse('SyliusAdminBundle:Dashboard:index.html.twig', ['statistics' => $statistics, 'channel' => $channel]);
}
示例14: registerForm
public function registerForm(Request $request)
{
if ($this->pageStack->isLoggedIn()) {
return $this->templating->renderResponse('JarvesBundle:User:logout.html.twig');
}
$user = new User();
$form = $this->formFactory->createBuilder()->setData($user)->add('email', EmailType::class)->add('password', PasswordType::class)->add('save', SubmitType::class, array('label' => 'Register'))->getForm();
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
}
return $this->templating->renderResponse('JarvesBundle:User:register.html.twig', ['form' => $form->createView()]);
}
示例15: renderResponse
/**
* {@inheritdoc}
*/
public function renderResponse($data = null)
{
if (false === is_array($data)) {
throw new \InvalidArgumentException('Data should be an array');
}
if (false === array_key_exists('template', $data)) {
throw new \InvalidArgumentException('Data should contain a "template" key');
}
if (false === array_key_exists('parameters', $data)) {
throw new \InvalidArgumentException('Data should contain a "parameters" key');
}
return $this->templating->renderResponse($data['template'], $data['parameters']);
}