2016-10-20 50 views
1

我尝试添加一个名为confirmAgbAction的动作的新控制器。该插件不允许控制器“X”

<?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.

+0

在一开始的最愚蠢的问题:你您已使用“清除所有缓存”来清除安装工具中的缓存 - 按钮? –

+0

从安装工具清除缓存 –

+0

不是一个愚蠢的问题;)是我清除了所有3个缓存,甚至清除了'typo3temp' – Black

回答

5

有你的错误两种可能性:

  1. 您使用柔性成型嵌入您的插件。或者您没有将Custom->confirmAgb添加到Flexform中允许的调用中,或者您添加了它但未更新该插件(插件配置仅在您保存插件/ tt_content元素时才更新)
  2. 您在页面上有两个插件,错误由另一个插件触发,因为那里不允许控制器 - >动作组合。

PS:尝试添加这对您的TS(SETUP.TXT)和插件现在应该选择默认的动作,如果给定一个也没有找到:

plugin.tx_yourextensionmvc.callDefaultActionIfActionCantBeResolved = 1 
+0

你说得对,我使用了两个插件,问题是因为flexform。 typo3懒惰的开发人员建议我不要使用'switchablecontrolleractions',所以我从flexforms中删除它。这只是在我还保存了插件/ tt_content之后才起作用。谢谢! – Black

+1

没有必要删除flexform功能,我很确定你也可以在Typo3 6.2.x中做一个解决方法。尝试将此添加到您的扩展setup.txt中: plugin.tx_yourextension { \t mvc.callDefaultActionIfActionCantBeResolved = 1 } –

1

您应该绝对避免在configurePlugin和其他Extbase上下文中使用$ _EXTKEY。 Extbase需要Vendor.ExtensionName格式 - $ _EXTKEY格式为lowercase_underscored。将这些参数定义为硬编码值可以解决您为给定插件解析控制器的问题。

准确地说:在您的命令中使用Eddcapone.Myextension作为注册/配置插件的命令的扩展名参数。

+0

谢谢你的信息!好吧,我已将每个发生在我的整个扩展中的'$ _EXTKEY'都更改为'MyExtension',但我仍然得到: '#1313855173:此插件不允许控制器“自定义”。请检查您的ext_localconf.php中的TYPO3 \ CMS \ Extbase \ Utility \ ExtensionUtility :: configurePlugin()。 因此,问题必须在其他地方。 – Black

+1

对任何人阅读的更新:原因是之前使用的switchableControllerActions,此外,在从* schema *中删除之后,重用包含switchableControllerActions * values *的内容元素记录。清理记录字段解决了它。 –

相关问题