我正在尝试为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'
);
有人可以帮忙吗?
答案 0 :(得分:2)
将近一个星期后,我找到了解决方案!
a)我的扩展程序的记录现在有了一个新的TCC字段,该字段会生成唯一的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}'}">
答案 1 :(得分:2)
确保skipDefaultArguments
在扩展TypoScript配置中未激活:
plugin.tx_myextension {
features {
skipDefaultArguments = 1
}
}
答案 2 :(得分:-1)
您清除了TYPO3缓存吗?