Project

General

Profile

Actions

Bug #86895

closed

routeEnhancer not working correct for paginate widget

Added by Jacco van der Post over 5 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2018-11-09
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
On Location Sprint

Description

routeEnhancers:
  CommunityPlugin:
    type: Extbase
    limitToPages: [15]
    extension: Blacommunity
    plugin: Blaforum
    routes:
    - routePath: ''
      _controller: 'Subforum::list'
    - routePath: '/{subforum_title}'
      _controller: 'Subforum::show'
      _arguments:
        'subforum_title': 'subforum'
    - routePath: '/{subforum_title}/{topic_title}/{page}'
      _controller: 'Topic::show'
      _arguments:
        'subforum_title': 'subforum'
        'topic_title': 'topic'
        'page': '@widget_0/currentPage'
    defaultController: 'Subforum::show'
    defaults:
      page: '0'
    requirements:
      page: '\d+'
    aspects:
      subforum_title:
        type: PersistedAliasMapper
        tableName: 'tx_blacommunity_domain_model_subforum'
        routeFieldName: 'slug'
      topic_title:
        type: PersistedAliasMapper
        tableName: 'tx_blacommunity_domain_model_topic'
        routeFieldName: 'slug'
      page:
        type: StaticRangeMapper
        start: '1'
        end: '1000'

Setting the defaults page on '1' or '0' has no effect, for pages 2 and further the routing works fine. On the first page '@widget_0/currentPage' cannot be found as an argument. I expected it the work as https://symfony.com/doc/current/routing/optional_placeholders.html: "By adding page to the defaults key, the {page} placeholder is no longer required. " so e.g.

URL    Route     Parameters
/blog           blog    {page} = 1
/blog/1           blog    {page} = 1
/blog/2           blog    {page} = 2

TYPO3 9.5.1.


Related issues 7 (0 open7 closed)

Related to TYPO3 Core - Bug #87436: Routing: empty 'defaults' entry does not workClosed2019-01-15

Actions
Related to TYPO3 Core - Bug #90149: Consider Symfony route modifierClosed2020-01-19

Actions
Related to TYPO3 Core - Bug #87731: ExtbasePluginEnhancer requirements ignoredClosed2019-02-18

Actions
Related to TYPO3 Core - Task #88686: Fix requirements in parameterClosed2019-07-04

Actions
Related to TYPO3 Core - Bug #89641: Routing configuration with 3rd party url segmentsClosed2019-11-11

Actions
Related to TYPO3 Core - Bug #90531: Requirements are not considered when an aspect is presentClosed2020-02-25

Actions
Related to TYPO3 Core - Bug #89185: Routing: requirements are not validated for PersistedAliasMapper in PluginEnhancer/ExtbasePluginEnhancerClosed2019-09-17

Actions
Actions #1

Updated by Jacco van der Post over 5 years ago

Update: the first time (not page 1) I click on the pagebrowser it works, clicking then on another page of the pagebrowser also does not work.

Actions #2

Updated by Jacco van der Post over 5 years ago

  • Subject changed from routeEnhancer not working for page 1 of paginate widget to routeEnhancer not working correct for paginate widget
Actions #3

Updated by Jacco van der Post over 5 years ago

Further investigation. So I have a list of topics with links like (decoded here) :

[1.] https://mysite.test/community
?tx_blacommunity_blaforum[action]=show
&tx_blacommunity_blaforum[controller]=Topic
&tx_blacommunity_blaforum[subforum]=1
&tx_blacommunity_blaforum[topic]=90
&cHash=8f508425fc790714af77ae33d800673e

This should change the HTML link into https://mysite.test/community/subforumtitle/topictitle
It does not, when {page} is included in the routepath.

When on that page [1.], the pagebrowser shows the correct links for pages 2 and further. Clicking on for example [2.] https://mysite.test/community/subforumtitle/topictitle/2 works. However on that page [2.] the links are not correct; page 1 links back to https://mysite.test/community and the other pages show the URL with parameters as above.

When entered by hand in the browser the links do work:
https://mysite.test/community/subforumtitle/topictitle/2
https://mysite.test/community/subforumtitle/topictitle/3
etc.

But https://mysite.test/community/subforumtitle/topictitle or https://mysite.test/community/subforumtitle/topictitle/1 does not work..

Since there is no RealUrl available anymore, I hope I find a solution soon... or I might end up replacing the fluid widget by coding my own pagebrowser. Thx

Actions #4

Updated by Vasyl Mosiychuk over 5 years ago

I have the same problem with the pagination widget...

Actions #5

Updated by Carsten Pohl over 5 years ago

Vasyl Mosiychuk wrote:

I have the same problem with the pagination widget...

Same behaviour here, the pagination widget looses all the arguments which are not the widget arguments.

Actions #6

Updated by Carsten Pohl over 5 years ago

Carsten Pohl wrote:

Vasyl Mosiychuk wrote:

I have the same problem with the pagination widget...

Same behaviour here, the pagination widget looses all the arguments which are not the widget arguments.

The widget needs the addquerystringmethod, then the widget keeps the variables.
<f:widget.paginate configuration="{addQueryString:1, addQueryStringMethod: 'GET'">

With this configuration for the routeEnhancers i get the right pagination.

- routePath: '/{category_var}'
  _controller: 'News::list'
  _arguments:
     category_var: cat
- routePath: '/{category_var}/{page}'
  _controller: 'News::list'
  _arguments:
   category_var: cat
   page: '@widget_0/currentPage'
Actions #7

Updated by Jacco van der Post over 5 years ago

@Carsten, thx good find.

However there is still a problem when using 'defaults', I would expect that if it's filled in, that the argument is not necessary.
I have this problem with another parameter (not from this Fluid pagination widget).

For example both URL's should work:

/blog blog {page} = 1
/blog/1 blog {page} = 1

Since I use now another solution then the Fluid pagination widget, could you test if this works for you?

Actions #8

Updated by Wolfgang Klinger over 5 years ago

  • Related to Bug #87436: Routing: empty 'defaults' entry does not work added
Actions #9

Updated by Benjamin Robinson about 5 years ago

The paginator link issue (page 2 to page 1) can also be solved by outsourcing the list view to an additional routeEnhancer of type "Plugin":

routeEnhancers:
  NewsDetail:
    type: Extbase
    extension: News
    plugin: Pi1
    routes:
      - { routePath: '/{news_title}', _controller: 'News::detail', _arguments: {'news_title': 'news'} }
    aspects:
      news_title:
        type: PersistedAliasMapper
        tableName: 'tx_news_domain_model_news'
        routeFieldName: 'path_segment'
  NewsList:
    type: Plugin
    routePath: '/{@widget_0/currentPage}'
    namespace: 'tx_news_pi1'
    aspects:
      '@widget_0/currentPage':
        type: StaticRangeMapper
        start: '1'
        end: '1000'

At least that worked successfully for the news extension.

Actions #10

Updated by Gerrit Code Review about 5 years ago

  • Status changed from New to Under Review

Patch set 2 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #11

Updated by Christian Hackl over 4 years ago

This patch https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361 doesn't work for me.
I have set type: Extbase - defaults: page: '1' - but if I go back from page 2 - the URL shows me the extension parameters (for example: domain.tld/list?tx_myext_plugin%5Baction%5D=list&tx_myext_plugin%5Bcontroller%5D=Controller&cHash=86ec23d78c357b460a441a2e2a720d0f
instead of "domain.tld/list/page-1" or "domain.tld/list"...

Actions #12

Updated by Pascal Geldmacher over 4 years ago

I've the same problem with the pagination widget. On our website we use the blog extension, which have the same problem if you go from page 2 to page 1
https:/my-page.test/blog/?tx_blog_posts%5Baction%5D=listRecentPosts&tx_blog_posts%5Bcontroller%5D=Post&cHash=cdbbbaf5a61a58771bfabda89c663f8b
and we also have the same error with our custom extension.

Actions #13

Updated by Gerrit Code Review over 4 years ago

Patch set 3 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #14

Updated by Susanne Moog over 4 years ago

  • Sprint Focus set to On Location Sprint
Actions #15

Updated by Gerrit Code Review over 4 years ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62885

Actions #16

Updated by Gerrit Code Review over 4 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62885

Actions #17

Updated by Gerrit Code Review over 4 years ago

Patch set 4 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #18

Updated by Gerrit Code Review over 4 years ago

Patch set 5 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #19

Updated by Gerrit Code Review over 4 years ago

Patch set 6 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #20

Updated by Gerrit Code Review over 4 years ago

Patch set 7 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #21

Updated by Gerrit Code Review about 4 years ago

Patch set 8 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #22

Updated by Oliver Hader about 4 years ago

  • Related to Bug #90149: Consider Symfony route modifier added
Actions #23

Updated by Gerrit Code Review about 4 years ago

Patch set 9 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #24

Updated by Gerrit Code Review about 4 years ago

Patch set 10 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #25

Updated by Gerrit Code Review about 4 years ago

Patch set 11 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #26

Updated by Gerrit Code Review about 4 years ago

Patch set 12 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #27

Updated by Gerrit Code Review about 4 years ago

Patch set 13 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #28

Updated by Gerrit Code Review about 4 years ago

Patch set 14 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #29

Updated by Gerrit Code Review about 4 years ago

Patch set 15 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #30

Updated by Gerrit Code Review about 4 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62885

Actions #31

Updated by Gerrit Code Review about 4 years ago

Patch set 16 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #32

Updated by Gerrit Code Review about 4 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62885

Actions #33

Updated by Gerrit Code Review about 4 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62885

Actions #34

Updated by Gerrit Code Review about 4 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62885

Actions #35

Updated by Gerrit Code Review about 4 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62885

Actions #36

Updated by Oliver Hader about 4 years ago

  • Related to Bug #87731: ExtbasePluginEnhancer requirements ignored added
Actions #37

Updated by Oliver Hader about 4 years ago

  • Related to Task #88686: Fix requirements in parameter added
Actions #38

Updated by Gerrit Code Review about 4 years ago

Patch set 17 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60361

Actions #39

Updated by Oliver Hader about 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #40

Updated by Oliver Hader about 4 years ago

  • Related to Bug #89641: Routing configuration with 3rd party url segments added
Actions #41

Updated by Felix Nagel about 4 years ago

Can somebody help me how to configure the pagination in order to have same URL for /list/ and /list/page/1 when on list page or page 1? I assumed this ticket would solve my "duplicate content / same page but different URL" problem but in TYPO3 9.l5.14 its still present. Any ideas?

Actions #42

Updated by Benjamin Robinson about 4 years ago

Felix Nagel wrote:

Can somebody help me how to configure the pagination in order to have same URL for /list/ and /list/page/1? I assumed this ticket would solve my "duplicate content / same page but different URL" problem but in TYPO3 9.l5.14 its still present. Any ideas?

Does my above example not work for you to solve duplicate content for page 1?

Actions #43

Updated by Felix Nagel about 4 years ago

Does my above example not work for you to solve duplicate content for page 1?

No, same issue. Plain list page and page 1 have the same content but different URLs.

Anyway, this should just work out of the box with the Extbase type, shouldn't it?

Actions #44

Updated by Christian Hackl about 4 years ago

I have a problem, too.

"OneListPlugin" works as expected (on page 0 respectively 1 it doesn't show the "seite-1" part, but "TwoListPlugin" does not.

TwoListPlugin:
- shows me "domain.tld/seite-3/type-0/area" instead of "domain.tld/seite-3/type-0/area-0" // which is also incorrect because i don't want "type-0" or "area-0"
- if i go back to page 0 respectively 1 than it gives me 404 and a url like "domain.tld/seite-0/type-0/area" instead of "domain.tld/type-0/area-0"

if I set the widget_0 ('{page-label}-{page}') to the end of the URL in the YAML config, like:

      - { routePath: '/{type-label}-{type}/{area-label}-{area}/{page-label}-{page}', _controller: 'Job::list', _arguments: {'page': '@widget_0/currentPage', 'type': 'types', 'area': 'areas'} }

then gives me on click on page 2 a url like: "domain.tld/type-0/area-0/seite-2".
If I click on page 1 I get a URL like: "domain.tld/type-0/area-0/seite" so without "-0" or "-1" or something.

What do I expect?
I would expect that if no arguments (page, types, areas) are set (i.e. 0), they won't appear in the URL at all - just like with "OneListPlugin".
And if I click back, i.e. on page 0 respectively 1 then, of course, the argument "page-0" should not appear in the URL.

  OneListPlugin:
    type: Extbase
    extension: ExtName
    plugin: PluginOne
    defaultController: 'One::list'
    routes:
      - { routePath: '/{page-label}-{page}', _controller: 'One::list', _arguments: {'page': '@widget_0/currentPage'} }
    defaults:
      page: ''
    requirements:
      page: '\d+'
    aspects:
      page: { type: StaticRangeMapper, start: '1', end: '100' }
      page-label: { type: LocaleModifier, default: 'page', localeMap: [{ locale: 'en_.*', value: 'page' }, { locale: 'de_.*', value: 'seite' }] }

  ### not working:
  TwoListPlugin:
    type: Extbase
    extension: ExtName
    plugin: PluginTwo
    defaultController: 'Two::list'
    routes:
      - { routePath: '/{page-label}-{page}/{type-label}{type}/{area-label}{area}', _controller: 'Two::list', _arguments: {'page': '@widget_0/currentPage', 'type': 'types', 'area': 'areas'} }
    defaults:
      page: ''
      type: ''
      area: ''
    requirements:
      page: '\d+' 
      type: '\d+'
      area: '\d+'
    aspects:
      page: { type: StaticRangeMapper, start: '1', end: '100' }
      page-label: { type: LocaleModifier, default: 'page', localeMap: [{ locale: 'en_.*', value: 'page' }, { locale: 'de_.*', value: 'seite' }] }
      type-label: { type: LocaleModifier, default: 'type-', localeMap: [] }
      area-label: { type: LocaleModifier, default: 'area-', localeMap: [] }

----
Edit:
forget to mention: I want to filter (html/fluid form) the pagination, these are the 2 values "types" and "areas".
This works fine so far - just not with the right URL...

Actions #45

Updated by Stefan P about 4 years ago

Now that requirements are not considered when an aspect is present a whole of our sites did break.

I have a customly programmed aspect (used in the ExtbasePluginEnhancer) which considered slashes and resolved the URL by itself (by exploding the slashes and finding the correct uid of the dataset). To make this work I did set the requirements to .* (because teh default requirement [^/]++ forbids slashes). We did this to have arbitrarily deep category trees which are represented in the url.

This change totally breaks this, because I can not set the requiements anymore. What is the solution for me here?

Actions #46

Updated by Oliver Bartsch about 4 years ago

  • Related to Bug #90531: Requirements are not considered when an aspect is present added
Actions #47

Updated by Benni Mack about 4 years ago

  • Status changed from Resolved to Closed
Actions #48

Updated by Oliver Hader about 4 years ago

  • Related to Bug #89185: Routing: requirements are not validated for PersistedAliasMapper in PluginEnhancer/ExtbasePluginEnhancer added
Actions #49

Updated by Moritz Ahl about 3 years ago

Can somebody point me to the solution for this? I still have the issue with page 2 pointing to page 1 in 9.5.24 with this configuration:

  MyPagination:
    type: Plugin
    limitToPages: [ 12163, 12162, 12165]
    namespace: 'tx_mypagination_page'
    routePath: 'p/{@widget_0/currentPage}'
    requirements:
      page: '\d+'
    defaults:
      page: ''
    aspects:
      '@widget_0/currentPage':
        type: StaticRangeMapper
        start: '1'
        end: '400'

Doesn't matter what I put in to defaults (empty, 1 or 0). Also, same result using the extbase variant.

Actions #50

Updated by Eric Chavaillaz over 2 years ago

For me it does not work. I do not use the Fluid widget but the new API (SimplePagination).
If I am on page 2, the link to page 1 is "/page/1" (or "/page") instead of "/".

Not possible to use the "Plugin" enhancer, the query string is like this :

?tx_news_pi1[controller]=News&tx_news_pi1[currentPage]=1&cHash=...

My configuration is :

routeEnhancers:
    News:
        aspects:
            page:
                end: '100'
                start: '1'
                type: StaticRangeMapper
            page-path:
                default: page
                localeMap:
                    -
                        locale: fr_.*
                        value: page
                type: LocaleModifier
        defaultController: News::list
        defaults:
            page: 1
        namespace: tx_news_pi1
        requirements:
            page: \d+
        routes:
            -
                _arguments:
                    page: currentPage
                _controller: News::list
                routePath: /{page-path}/{page}
        type: Extbase

Any idea?
Thanks

Actions #51

Updated by Emile Blume over 2 years ago

I tried to add enhance my paginator to display the right language. For me this worked:

  NewsList:
    type: Plugin
    namespace: tx_news_pi1
    routePath: '/{localized_page}/{@widget_0/currentPage}'
    aspects:
      '@widget_0/currentPage':
        type: StaticRangeMapper
        start: '1'
        end: '100'
      localized_page:
        type: LocaleModifier
        default: 'page'
        localeMap:
          - locale: 'en_EN.*'
            value: 'page'
          - locale: 'nl_NL.*'
            value: 'pagina'
Actions

Also available in: Atom PDF