Reputation: 836
I have build an extension which I am bootstrapping with Typoscript and placing it in a modal box. I also have the same extension included in a Page element but with a different action.
The problem is when calling other actions from the extension in the Page it also reflects what is displayed in the bootstrapped version in the modal box. What I want to do is no matter what arguments are in the URL (which tell the extension what action to execute) the one in the modal box to always call the same action first.
Is this possible?
Should I probably look for a different solution to my problem?
Upvotes: 0
Views: 273
Reputation: 11
Do you call both of your Controller/Action sets in one Plugin? I would try to split them fe like this
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'VENDOR.' . $_EXTKEY,
'Pluginkey1',
array(
'FirstController' => 'foo, bar',
),
// non-cacheable actions
array(
'FirstController' => '',
)
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'VENDOR.' . $_EXTKEY,
'Pluginkey2',
array(
'SecondController' => 'baz',
),
// non-cacheable actions
array(
'SecondController' => '',
)
);
Upvotes: 0
Reputation: 9671
The easiest way in my opinion would be an AbstractContoller
from which two different controller inherit.
This way the would be separated completely but could share the same actions:
namespace YOUR\Extension\Controller;
abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController{
public function firstAction(){
// your code here
}
public function secondAction(){
// your code here
}
}
First Controller:
namespace YOUR\Extension\Controller;
class FirstController extends AbstractController{
//no need to add actions here
}
Second Controller:
namespace YOUR\Extension\Controller;
class SecondController extends AbstractController{
//no need to add actions here
}
Your typoscript included on the page would then call FirstController->firstAction
, the one in the modal would call SecondController->firstAction
. If you transfer a different action via GET, it will only affect either the first or the second Controller.
Don't forget:
Upvotes: 1