问题
I try to add a new controller which has one action called confirmAgbAction
.
<?php
namespace Eddcapone\MyExtension\Controller;
/**
* CustomController
*/
class CustomController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
/**
* action list
*
* @return void
*/
public function confirmAgbAction()
{
echo "<p>HALLO WELT</p>";
}
}
I even added it to ext_localconf.php
<?php
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Eddcapone.' . $_EXTKEY,
'Myfilelist',
array(
'Category' => 'list,show',
'File' => 'show',
'Download' => 'download',
'Custom' => 'confirmAgb'
),
// non-cacheable actions
array(
'Category' => 'list,show',
'File' => 'topFive',
'Download' => 'download',
'Custom' => 'confirmAgb'
)
);
This is how I call the action in the template:
<f:link.action controller="Custom" action="confirmAgb" pluginName="Myfilelist" class="mbButton">Download</f:link.action>
However, i always get:
#1313855173: The controller "Custom" is not allowed by this plugin. Please check for TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.
回答1:
There are two common possibilities for your error:
- You use a flexform to embed your plugin. Either you have not added
Custom->confirmAgb
to the allowed calls in your flexform or you have added it but did not update the plugin (plugin configuration only updates when you save the plugin/tt_content element) - You have two plugins on the page and the error is triggered by the other plugin because there the
controller->action
combination is not allowed.
PS: try adding this to your TS (setup.txt) and the plugins now should pick the default action if the given one is not found:
plugin.tx_yourextensionmvc.callDefaultActionIfActionCantBeResolved = 1
There could be more uncommon cases
回答2:
You should absolutely avoid using $_EXTKEY in configurePlugin and other Extbase contexts. Extbase requires the Vendor.ExtensionName
format - $_EXTKEY is in the lowercase_underscored
format. Defining those parameters as hardcoded values should solve your problem with resolving controllers for your given plugin.
To be precise: use Eddcapone.Myextension
as extension name parameter in your command(s) to register/configure plugins.
来源:https://stackoverflow.com/questions/40150145/the-controller-x-is-not-allowed-by-this-plugin