Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of the cHash with routing enhancers?

I want to get rifd of the cHash get parameter when using routing enhancers with custom extension.

The TYPO3 docs/changelog assume that this is possible:

If you really have the requirement to never have a cHash argument, ensure that all placeholders are having strict definitions on what could be the result of the page segment ...

But what exactly does strict definitions mean.

This is my routing configuration:

routeEnhancers:
  ExecutiveSearchResultList:
    type: Extbase
    extension: executivesearch
    plugin: searchresultlist
    routes:
        - { routePath: '/list/{page}', _controller: 'Search::searchResultList', _arguments: {'page': 'page'} }
    defaultController: 'Search::searchResultList'
    defaults:
      page: '1'
      action: 'searchResultList'
      controller: 'Search'
    requirements:
      page: '\d+'

the result is

/path/to/my-page/list/1?cHash=6cd242916809d29b799debe824b37fcd

I also have a routing for tx_news that works fine do not append a cHash:

NewsPlugin:
    type: Extbase
    extension: news
    plugin: Pi1
    routes:
      - { routePath: '/list/{page}', _controller: 'News::list', _arguments: {'page': '@widget_0/currentPage'} }
      - { routePath: '/tag/{tag_name}', _controller: 'News::list', _arguments: {'tag_name': 'overwriteDemand/tags'}}
      - { routePath: '/news/{news_title}', _controller: 'News::detail', _arguments: {'news_title': 'news'} }
      - { routePath: '/archive/{year}/{month}', _controller: 'News::archive' }
    defaultController: 'News::list'
    aspects:
      news_title:
        type: PersistedAliasMapper
        tableName: 'tx_news_domain_model_news'
        routeFieldName: 'path_segment'
    defaults:
      page: '0'
    requirements:
      page: '\d+'
like image 474
g-ffm Avatar asked Dec 06 '25 05:12

g-ffm


1 Answers

My workaround was a StaticRangeMapper.

Hint: 1000 is currently the maximum in the TYPO3 core.

  NewsPlugin:
    type: Extbase
    limitToPages:
      - 56
    extension: News
    plugin: Pi1
    routes:
      - routePath: '/list/{page}'
        _controller: 'News::list'
        _arguments:
          page: '@widget_0/currentPage'
      - routePath: '/detail/{news_title}'
        _controller: 'News::detail'
        _arguments:
          news_title: news
    defaultController: 'News::list'
    defaults:
      page: '0'
    requirements:
      page: \d+
    aspects:
      page:
        type: StaticRangeMapper
        start: '1'
        end: '1000'
      news_title:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_news
        routeFieldName: path_segment
like image 89
Guido S Avatar answered Dec 09 '25 01:12

Guido S



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!