Default controller of 2nd plugin in extension can not be determined - typo3

I made an extbase extension with extension builder in TYPO3 6.2 and so far I have one working frontend plugin. But now I want to add another plugin that can use the same Classes of that extension and I can't even successfully add it.
When clicking on the page that should show my new plugin I receive this error:
Caught exception: The default controller for extension ...
and plugin "Stats" can not be determined. Please check for
TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your
ext_localconf.php.
This is what I did previously:
After adding a new plugin "Stats" in the extension builder I see following code in my ext_localconf.php:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'CC.' . $_EXTKEY,
'Appoints',
array(
'Appointment' => 'list, show, new, create, edit',
'Feedback' => 'new, create, list',
),
// non-cacheable actions
array(
'Appointment' => 'list, show, new, create, edit',
'Feedback' => 'new, create, list',
)
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'CC.' . $_EXTKEY,
'Stats',
array(
'Appointment' => 'statistic',
),
// non-cacheable actions
array(
'Appointment' => 'statistic',
)
);
And in ext_tables.php I got:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'CC.' . $_EXTKEY,
'Appoints',
'Appointments'
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'CC.' . $_EXTKEY,
'Stats',
'Statstics'
);
It seems the extension builder did everything perfectly.
In my AppointmentController.php
(which is correctly namespaced - namespace Vendor\Extname\Controller;) I added:
public function statisticAction() {
echo "testing";
}
Then I added the new plugin to my page in the backend. (Please ignore the spelling error in the picture I already corrected it but it wasn't the cause of my problem)
So what could be the reason? And how can I solve this the easiest way?
Should I type something into the switchableControllerActions in extension builder since I'm using the same controller with both plugins but different actions? If so - what?
EDIT: I found out it must have something to do with my backend page, idk what - but if I change the plugin on the same page it works,...I'm searching for the causing differences between the two pages that might cause this...

You made a typo in your ext_localconf.php when you declared your second plugin,
"Stats": \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'CC.' . $_EXTKEY,
'Stats',
array(
'Appointment' => 'statistic', ==> 'Statistics' => 'statistic'
),
// non-cacheable actions
array(
'Appointment' => 'statistic', ==> 'Statistics' => 'statistic'
)
);
because "Statistics" is the right controller name for that plugin if you called it "StatisticsController".

Like everyone in the comments stated all I did was correct and should've worked...
I noticed that my plugins worked on one backend page but didn't work on another.
As I couldn't find any differences between those two pages that caused this I deleted both of them and created two new ones inserting one plugin into each page.
Now it works...so my solution if you encounter a similar problem:
Before trying to dig too deep into the cause just try to delete a problematic backend page and create a new one. Maybe it can solve the problem, it did it for me.

Related

TYPO3: Communicate between two plugins

I have made two plugins, one will call listAction and display a list of records and the other one will call viewAction to display the selected record.
How can I display a page where I have created the show plugin with the uid of the record I want to display?
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Vendor.Extension',
'List',
[
\Vendor\Extension\Controller\Controller::class => 'list',
],
[
\Vendor\Extension\Controller\Controller::class => '',
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Vendor.Extension',
'View',
[
\Vendor\Extension\Controller\Controller::class => 'show',
],
[
\Vendor\Extension\Controller\Controller::class => '',
]
);
What I need to do is kind of what the extension News does but the way is done in that extension is deprecated and TYPO3 says that we have to do it using multiple plugins now.
https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/10.3/Deprecation-89463-SwitchableControllerActions.html
The "communication" is not between your plugins, but via the page request. Following a "more/detail"-link in your list will reload the page with additional parameters.
Here, f:link.action is, what you're looking for. This ViewHelper enables you to link to a specified extension (extensionName), plugin (pluginName), controller (controller) and action (action).

The default controller for extension \"X\" and plugin \"X\" can not be determined

Good Afternoon all.
I'm trying to make an extension for TYPO3 8.7 but I'm getting this error and I have tried everything without any luck.
ext_localconf.php
<?php
defined('TYPO3_MODE') || die('Access denied.');
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'AOE.' . $_EXTKEY,
'AoeShowroom',
[
\AOE\AoeShowroom\Controller\ShoeController::class => 'list, show',
],
// non-cacheable actions
[
\AOE\AoeShowroom\Controller\ShoeController::class => '',
]
);
tt_content.php
<?php
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'AOE.AoeShowroom',
'AoeShowroom',
'AOE Showroom',
'EXT:aoe_showroom/Resources/Public/Icons/Extension.svg'
);
ShoeController.php
<?php
namespace AOE\AoeShowroom\Controller;
...
?>
If you need any other file please request.
Thanks
This happens because you have formerly created an extension plugin on this page. Later you have changed the former plugin into this plugin. The error message comes from the flexform field of the former plugin. Now it cannot find the controller, because the flexform does not fit to the current plugin.
Solution: Delete the flexform of this tt_content recore by a database tool, e.g. phpmyadmin. Use the id of the plugin record as uid of tt_content.
UPDATE `tt_content` SET `pi_flexform` = '' WHERE `tt_content`.`uid` = 29;
see German page

Typo3 RealUrl: add term to pagination url

I wrote a press release plugin listing several releases using the paginate widget. Using RealUrl the URL of the listing site looks like this: www.mysite.com/press/2/
Is it possible to add another term to the page parameter? So it looks like this: www.mysite.com/press/page-2/
I would also need this for two languages.
This is part of my RealUrl configuration:
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
'fixedPostVars' => array(
'127' => array( // Press release overview
array(
'GETvar' => 'tx_press_releaselist[#widget_0][currentPage]',
)
),
)
);
A possible solution would be to use a valueMap. Only downside would be that you would provide every value. So if you expect 100 pages, you need to add those 100 numbers to the realurl configuration.

how to : specify a default action for a TYPO3 v4.5.30 extbase extension?

I made a new extension in extension builder (a basic 4 model extension with no custom work in it, the only thing slightly fancy it does is extend the fe_users table) and installed it and made a page with the plugin and when I view the page I get a blank area where the plugin should appear - not a whole blank page just the part where the plugin should appear. I put some echo __FUNCTION__.__LINE__;die; lines in all the listActions so if I was hitting any of them I'd at least know which I was hitting. But I see no echo lines and I clearly never hit a die; so I guess my extension is not hitting any action, maybe because I have to specify one as the default. My extension has 4 models. How do I specify what action gets called? I am using typo3 v4.5.30 with extbase.
Thanks
PS: my ext_localconf file looks like so:
Tx_Extbase_Utility_Extension::configurePlugin(
$_EXTKEY,
'mycore',
array(
'Player' => 'list, show, new, create, edit, update, delete',
'Hall' => 'list, show, new, create, edit, update, delete',
'Hallplayers' => 'list, show, new, create, edit, update, delete',
'Hallvisits' => 'list, show, new, create, edit, update, delete',
),
// non-cacheable actions
array(
'Player' => 'create, update, delete',
'Hall' => 'create, update, delete',
'Hallplayers' => 'create, update, delete',
'Hallvisits' => 'create, update, delete',
)
);
To answer your initial question: The first action defined in your plugin is automatic the default action. I never use 2 Actioncontroller in 1 plugin (Im not sure if that is even possible). If I have to change from 1 actioncontroller to another I use Fluid-Link:
<f:link.action pluginName="myOtherPlugin" pageUid="ThePageIDwhereThePluginShallBeCalled" action="TheActionOfThePlugin" controller="Controllername" arguments="{Modelname : Modelobject}">

Zend_Navigation overwrite with array?

I currently use zend_navigation via an XML file.
However I need to overwrite the previous breadcrumb to be its dynamic parent, in the controller.
Is this possible? It seems to me that zend_navigation is fairly static and the zend documentation keeps timing out.
Thanks
I have put:
public function addAction() {
$this->view->navigation()->addPage(array(
'type' => 'uri',
'label' => 'New page')
);
in my controller but no crumbbar shows up for that page.
Any ideas? $this->navigation() threw a
Method "navigation" does not exist and was not trapped in __call()
Also of note that my crumbBar is in my layout and not individual views.
Yes you can use an array.
What you should do really is create your array and then input it into the factory of the Zend_Navigation to create your pages for you.
Unfortunately my code is too complicated to show an example of how I used it. But I'll provide a simple example...
Once you create your navigation container, you can just add new pages to it.
Like
$this->navigation()->addPage(array(
'type' => 'uri',
'label' => 'New page'));
But you can also use addPages(). This is what I do.
I think you should just wait for the documentation to load back up for you and then look at that. Its really easy in fact.
When you have a more specific question, just ask that and give me a poke. I've had to use Navigation quite a lot so know it quite well.
Additionally, check out #zftalk on freenode. Theres lots of help on there.
// Disable Layout
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
// Output XML than HTML
$this->getResponse()->setHeader('Content-Type', 'text/xml; charset=utf-8');
$container = new Zend_Navigation();
// Replace this section with real dynamic data.
$pages = array(
array(
'label' => 'Save',
'action' => 'save',
),
array(
'label' => 'Delete',
'action' => 'delete',
),
);
// Add pages
$container->addPages($pages);
$this->view->navigation($container);
// Output the data.
echo $this->view->navigation()->sitemap();
Additionally uses Zend Router for redirecting site.com/sitemap.xml to this controller/function.
Thank you for many developers who help me to reach here.