我尝试添加一个新的控制器,它有一个名为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>";
}
}
我甚至把它添加到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'
)
);
这是我在模板中调用动作的方式:
<f:link.action controller="Custom" action="confirmAgb" pluginName="Myfilelist" class="mbButton">Download</f:link.action>
然而,我总是得到:
#1313855173: The controller "Custom" is not allowed by this plugin. Please check for TYPO3'CMS'Extbase'Utility'ExtensionUtility::configurePlugin() in your ext_localconf.php.
你的错误有两种常见的可能性:
- 你使用flexform来嵌入你的插件。要么您没有将
Custom->confirmAgb
添加到您的flexform中允许的调用,要么您已经添加了它,但没有更新插件(插件配置仅在保存plugin/tt_content元素时更新) - 页面上有两个插件,错误是由另一个插件触发的,因为那里的
controller->action
组合是不允许的。
PS:试着把这个添加到你的TS (setup.txt)中,如果没有找到,插件现在应该选择默认的操作:
plugin.tx_yourextensionmvc.callDefaultActionIfActionCantBeResolved = 1
可能会有更多不常见的情况
你应该绝对避免在configurePlugin和其他Extbase上下文中使用$_EXTKEY。Extbase需要Vendor.ExtensionName
格式- $_EXTKEY是lowercase_underscored
格式。将这些参数定义为硬编码值应该可以解决为给定插件解析控制器的问题。
确切地说:使用Eddcapone.Myextension
作为扩展名参数在你的命令(s)注册/配置插件