此插件不允许使用控制器"X"

Bla*_*ack 2 php typo3 typo3-6.2.x

我尝试添加一个名为一个动作的新控制器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>";    
    }
}
Run Code Online (Sandbox Code Playgroud)

我甚至把它添加到了 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'
    )
);
Run Code Online (Sandbox Code Playgroud)

这就是我在模板中调用操作的方式:

<f:link.action controller="Custom" action="confirmAgb" pluginName="Myfilelist" class="mbButton">Download</f:link.action>
Run Code Online (Sandbox Code Playgroud)

但是,我总是得到:

#1313855173: The controller "Custom" is not allowed by this plugin. Please check for TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.

Dim*_* L. 7

您的错误有两种可能性:

  1. 您使用flexform嵌入您的插件.您没有添加Custom->confirmAgb到flexform中的允许调用,或者您已添加但未更新插件(插件配置仅在保存插件/ tt_content元素时更新)
  2. 您在页面上有两个插件,错误由另一个插件触发,因为不允许使用controller-> action组合.

PS:尝试将此添加到您的TS(setup.txt),如果找不到给定的插件,插件现在应该选择默认操作:

plugin.tx_yourextensionmvc.callDefaultActionIfActionCantBeResolved = 1
Run Code Online (Sandbox Code Playgroud)