EdwardBlack EdwardBlack - 1 month ago 18
PHP Question

The controller "X" is not allowed by this plugin

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.

Answer

There are two possibilities for your error:

  1. 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)
  2. 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