1

我正在尝试为 extbase 扩展设置新的语音 URL 路由。但是前端的详细信息链接绝对没有任何反应。

这是我的 yaml 站点配置代码(NewsPlugin 配置工作,但 CardealerPlugin 没有):

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'
);

有人可以帮忙吗?

4

2 回答 2

4

如果在 TypoScript 设置中为您的插件启用了“skipDefaultArguments”功能,则当前有一个错误https://forge.typo3.org/issues/87542会中断非默认插件控制器的路由。

所以暂时,确保它在你的扩展 TypoScript 配置skipDefaultArguments 没有激活:

plugin.tx_myextension {
    features {
        skipDefaultArguments = 0
    }
}

此外,检查扩展的默认 TypoScript 设置是否包含在您的 TypoScript 模板中。

于 2018-11-23T00:33:30.383 回答
3

将近一周后,我找到了解决方案!

a) 我的扩展记录现在有新的 slug TCA 字段,它生成唯一的 URL 段。

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

b) 我的 YAML 配置:

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) 流体连接

<f:link.action action="show" controller="Standard" pageUid="{settings.pid.details}" arguments="{car: '{car.uid}'}">
于 2018-10-26T16:53:37.943 回答