Search code examples
routestypo3extbasetypo3-9.x

TYPO3 9.5 - Problems with new Routing Enhancers


i'm trying to setup the new speaking URL routing for an extbase extension. but absolutly nothing happens with the details links in frontend.

here is my yaml site config code (the NewsPlugin config is working, but CardealerPlugin does not):

routeEnhancers:
  NewsPlugin:
    type: Extbase
    limitToPages: [92,93]
    extension: News
    plugin: Pi1
    routes:
      - { routePath: '/{news_title}', _controller: 'News::detail', _arguments: {'news_title': 'news'} }
    defaultController: 'News::detail'
    aspects:
      news_title:
        type: PersistedAliasMapper
        tableName: 'tx_news_domain_model_news'
        routeFieldName: 'title'
        routeValuePrefix: '/'
  CardealerPlugin:
    type: Extbase
    limitToPages: [84,90]
    extension: Cardealer
    plugin: Pi1
    routes:
      - { routePath: '/{model_description}', _controller: 'Cardealer::show', _arguments: {'model_description': ' car'} }
    defaultController: 'Cardealer::show'
    aspects:
      model_description:
        type: PersistedAliasMapper
        tableName: 'tx_cardealer_domain_model_car'
        routeFieldName: 'model_description'
        routeValuePrefix: '/'

extTables.php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'Cardealer',
    'Pi1',
    'Cardealer'
);

can anybody help please?


Solution

  • After almost a week I found a solution!

    a) The records of my extension have now the new slug TCA field, which generates unique URL segments.

    'slug' => [
        'exclude' => true,
        'label' => 'URL Segment',
        'config' => [
            'type' => 'slug',
            'prependSlash' => true,
            'generatorOptions' => [
                'fields' => ['title'],
                'prefixParentPageSlug' => true,
            ],
            'fallbackCharacter' => '-',
            'eval' => 'uniqueInSite',
        ],
    ],
    

    b) My YAML Config:

    routeEnhancers:
      CardealerPlugin:
        type: Extbase
        limitToPages: [86]
        extension: Cardealer
        plugin: Pi1
        routes:
          -
            routePath: '/{uid_var}'
            _controller: 'Standard::show'
            _arguments:
              uid_var: car
        defaultController: 'Standard::list'
        aspects:
          uid_var:
            type: PersistedAliasMapper
            tableName: 'tx_cardealer_domain_model_car'
            routeFieldName: 'slug'
    

    c) The fluid link

    <f:link.action action="show" controller="Standard" pageUid="{settings.pid.details}" arguments="{car: '{car.uid}'}">