Uploaded image for project: 'Ibexa IBX'
  1. Ibexa IBX
  2. IBX-993

Admin Preview error when template includes pagerfanta paginator

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • 3.3.5, 3.3.6, 3.3.7
    • Content, Open Source
    • Ibexa Content, Ibexa Open Source

    Description

      Video: https://youtu.be/R2qfsZhNgjQ

      Steps to reproduce

      Install clean Ibexa DXP 3

      Update: config/packages/ezplatform_welcome_page.yaml

      Define the controller:

      # You can safely delete this file to disable welcome page
      ezplatform:
          system:
              site:
                  content_view:
                      full:
                          welcome_page:
                              template: "@ezdesign/full/welcome_page.html.twig"
                              # this is the only change
                              controller: App\Controller\HomeController::showAction
                              match:
                                  Id\Location: 2
                              params:
                                  project_dir: '%kernel.project_dir%'
      

      Update templates/themes/standard/full/welcome_page.html.twig

      {% extends '@ezdesign/pagelayout.html.twig' %}
      
      {% block content %}
          {{ pagerfanta( pager ) }}
      {% endblock %}
      

      Create the controller codeĀ src/Controller/HomeController.php

      <?php
      
      namespace App\Controller;
      
      use eZ\Bundle\EzPublishCoreBundle\Controller;
      use eZ\Publish\API\Repository\Values\Content\LocationQuery;
      use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
      use eZ\Publish\Core\MVC\Symfony\View\ContentView;
      use eZ\Publish\Core\Pagination\Pagerfanta\ContentSearchAdapter;
      use Pagerfanta\Pagerfanta;
      
      class HomeController extends Controller
      {
          public function showAction(ContentView $view): ContentView
          {
              $location = $view->getLocation();
              $query = new LocationQuery();
              $query->filter = new Criterion\LogicalAnd([
                  new Criterion\ParentLocationId($location->id),
              ]);
              $query->limit = 1;
              
              $pager = new Pagerfanta(
                  new ContentSearchAdapter( $query, $this->getRepository()->getSearchService() )
              );
              $pager->setMaxPerPage(1);
              $pager->setCurrentPage(1);
              $view->addParameters([
                  'pager' => $pager,
              ]);
              return $view;
          }
      }
      
      

      Go the admin interface, create two articles below the home page location.

      Check the frontend.

      Edit the content in the backend and click preview. Ibexa throws the following error:

      RuntimeError
      HTTP 500 Internal Server Error
      An exception has been thrown during the rendering of a template ("The request aware route generator can not guess the route when used in a sub-request, pass the "routeName" option to use this generator.").

      Designs

        Attachments

          Activity

            People

              Unassigned Unassigned
              d674a705-0864-4b4c-899c-19136e429c4a@accounts.ibexa.co Don't Toy With Me, Ibexa DXP
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: