When accessing the details page an exception is thrown: The action "details" (controller "Products") is not allowed by this plugin.
My Route Enhancer looks like this:
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
The Plugin is embedded via 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]
The links in the Fluid-Template are generated by:
<f:link.action class="button more" pageUid="38" action="details" arguments="{productId: '{product.product.id}'}">Mehr</f:link.action>
I tried switching between list & details for _controller
and defaultController
. I also tried removing one or both, but either the generated links contain the GET-Params or the Detailview creates the error message above.
Can anyone push me into the right direction?
Thanks in advance!
EDIT:
When I remove _controller: 'Products::details'
the error message is gone and my details action is called properly. But then the links to the details action contain the regular GET-params.
The problem was that the plugin was embedded multiple times on the same page, which causes problems.
To solve this you can either create different plugins or set plugin.tx_myext_products.mvc.callDefaultActionIfActionCantBeResolved = 1