该插件不允许控制器

The controller is not allowed by this plugin

我尝试添加一个新控制器,它有一个名为 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.

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

准确地说:在 register/configure 插件的命令中使用 Eddcapone.Myextension 作为扩展名称参数。

您的错误有两种常见的可能性:

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

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

plugin.tx_yourextensionmvc.callDefaultActionIfActionCantBeResolved = 1

可能还有更多不常见的情况