简体   繁体   中英

How to set up the route enhancer in typo3 v9.5

i have a problem with the routing in 9.5. I have two different plugins and two different models.

The storage folders of the models are in the root and different tree pages should access those folders.

The routing works fine but if the url slugs are the same, one plugin is not showing the detail view but in that case the list view even if the url is showing the detail view.

For example this shows the list view: departments/detail/test1 and this show the correct detail view services/detail/test1

Below is my current configuration. Anyone with an idea whats wrong?

Many thanks in advance

 ServicelistPlugin:
type: Extbase
extension: Catalog
plugin: Servicelist
routes:
  -
    routePath: '/{service_name}'
    _controller: 'Service::show'
    _arguments:
      service_name: service
defaultController: 'Service::list'
defaults:
  page: '0'
requirements:
  page: \d+
aspects:
  service_name:
    type: PersistedAliasMapper
    tableName: tx_catalog_domain_model_service
    routeFieldName: path_segment


 DepartmentlistPlugin:
    type: Extbase
    extension: Catalog
    plugin: Departmentlist
    routes:
      -
        routePath: '/{department_name}'
        _controller: 'Department::show'
        _arguments:
          department_name: department
    defaultController: 'Department::list'
    defaults:
      page: '0'
    requirements:
      page: \d+
    aspects:
      department_name:
        type: PersistedAliasMapper
        tableName: tx_catalog_domain_model_department
        routeFieldName: path_segment

As described in https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.5/Feature-86365-RoutingEnhancersAndAspects.html#simple-enhancer you have the option to add a limitToPages in your Enhancer. So your slugs will only take effect in the place you define. This should solve your problem, as I see, your detail plugins are located on different pages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM