TYPO3 路由:同一页面上的列表和详细信息操作
TYPO3 Routing: List & Details Action on same Page
访问详情页抛出异常:The action "details" (controller "Products") is not allowed by this plugin.
我的 Route Enhancer 看起来像这样:
ProductsPlugin:
type: Extbase
extension: Myext
plugin: Products
routes:
-
routePath: '/{product_slug}'
_controller: 'Products::details'
_arguments:
product_slug: productId
defaultController: 'Products::list'
defaults:
productId: '0'
aspects:
product_slug:
type: ProductsValueMapper
插件通过TypoScript嵌入:
lib.productsContent = USER
lib.productsContent {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = Myext
pluginName = Products
vendorName = Vendor
switchableControllerActions {
Products {
1 = list
}
}
}
[request.getQueryParams()['tx_myext_products']['productId'] > 0]
lib.productsContent.switchableControllerActions.Products.1 = details
[end]
Fluid-Template 中的链接由以下人员生成:
<f:link.action class="button more" pageUid="38" action="details" arguments="{productId: '{product.product.id}'}">Mehr</f:link.action>
我尝试在 _controller
和 defaultController
的列表和详细信息之间切换。我也尝试删除一个或两个,但生成的链接包含 GET-Params 或 Detailview 创建上面的错误消息。
谁能把我推向正确的方向?
提前致谢!
编辑:
当我删除 _controller: 'Products::details'
时,错误消息消失了,我的详细信息操作被正确调用。但是随后指向详细信息操作的链接包含常规 GET 参数。
你能检查一下这个补丁吗? https://review.typo3.org/c/59343/ 包括我在内的两个人遇到了同样的问题。
问题是插件在同一个页面被多次嵌入,导致出现问题。
要解决这个问题,您可以创建不同的插件或设置 plugin.tx_myext_products.mvc.callDefaultActionIfActionCantBeResolved = 1
访问详情页抛出异常:The action "details" (controller "Products") is not allowed by this plugin.
我的 Route Enhancer 看起来像这样:
ProductsPlugin:
type: Extbase
extension: Myext
plugin: Products
routes:
-
routePath: '/{product_slug}'
_controller: 'Products::details'
_arguments:
product_slug: productId
defaultController: 'Products::list'
defaults:
productId: '0'
aspects:
product_slug:
type: ProductsValueMapper
插件通过TypoScript嵌入:
lib.productsContent = USER
lib.productsContent {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = Myext
pluginName = Products
vendorName = Vendor
switchableControllerActions {
Products {
1 = list
}
}
}
[request.getQueryParams()['tx_myext_products']['productId'] > 0]
lib.productsContent.switchableControllerActions.Products.1 = details
[end]
Fluid-Template 中的链接由以下人员生成:
<f:link.action class="button more" pageUid="38" action="details" arguments="{productId: '{product.product.id}'}">Mehr</f:link.action>
我尝试在 _controller
和 defaultController
的列表和详细信息之间切换。我也尝试删除一个或两个,但生成的链接包含 GET-Params 或 Detailview 创建上面的错误消息。
谁能把我推向正确的方向?
提前致谢!
编辑:
当我删除 _controller: 'Products::details'
时,错误消息消失了,我的详细信息操作被正确调用。但是随后指向详细信息操作的链接包含常规 GET 参数。
你能检查一下这个补丁吗? https://review.typo3.org/c/59343/ 包括我在内的两个人遇到了同样的问题。
问题是插件在同一个页面被多次嵌入,导致出现问题。
要解决这个问题,您可以创建不同的插件或设置 plugin.tx_myext_products.mvc.callDefaultActionIfActionCantBeResolved = 1