如何在 Typo3 9 中配置 routeEnhancers?

How to configure the routeEnhancers in Typo3 9?

我使用的是 typo3 9,5,我正在尝试从扩展程序生成路由。一切正常,直到我发现只要 URL 太多,路由的参数就会导致错误

示例:

testRoute:
type: Extbase
extension: testExtension
plugin: testMain
routes:
  - { routePath: '/test/info/{name}/{period}', _controller: 
    'content::info', _arguments: {'name': 'name','period': 'period'} }
defaultController: 'content::info'
aspects:
  # here we get the needed information for a nice URL for _arguments
  name:
    type: PersistedAliasMapper
    tableName: 'xx'
    routeFieldName: slug
  period:
    type: PersistedAliasMapper
    tableName: 'xx'
    routeFieldName: slug

路线运行良好。 问题: 如果我有任何以句点作为名称的页面(testperiod)typo3 尝试生成我定义的 testRoute

   Error
   Parameter "tx_testextension_info__period" for route "tx_testextension_info_0" must 
     match 
    "[^/]++" ("" given) to generate a corresponding URL.

即使 URL 是: /xxxxxxxxxxxxxxxperiod 将抛出错误

如何限制分机的路由。

您可以尝试使用参数 limitToPages 限制路由对指定页面的影响。 示例:

  NewsList:
    type: Plugin
    limitToPages: [3]
    routePath: '/{@widget_0/currentPage}'
    namespace: 'tx_news_pi1'
    aspects:
      '@widget_0/currentPage':
        type: StaticRangeMapper
        start: '1'
        end: '1000'

在这个例子中,我的路由只在第 3 页有效。