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).
Related
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
I'am working with Typo3 V8
And I need to add some extra fields in BE so a have created an extension that allow me to add extra fields and it's working fine.
My problem is
All the fields are showing in all pages
some fields shouldn't be appearing in all pages
For example my home page contain a slider so in BE I have fields for uploading images but in other pages I don't need these fields to be shown.
You could add a special doktype that has the extra fields.
Let's assume it will be doktype 163, then in ext_localconf.php add:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(
'options.pageTree.doktypesToShowInNewPageDragArea := addToList(163)'
);
to add it to the list of page types above the pagetree.
In the same file register the icon for the doktype:
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Imaging\IconRegistry::class
)->registerIcon(
'apps-pagetree-mytype',
TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
[
'source' => 'EXT:' . $extKey . '/Resources/Public/Icons/Mytype.svg',
]
);
(Of course you need to add your svg image or use a different icon provider to register a bitmap)
In Configuration/TCA/Overrides/pages.php put:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
'pages',
'doktype',
[
'Page type name',
163,
'apps-pagetree-mytype'
],
'1',
'after'
);
$GLOBALS['TCA']['pages']['ctrl']['typeicon_classes'][163] = 'apps-pagetree-mytype';
Instead of adding your custom fields with a call to \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes() you add them with:
$GLOBALS['TCA']['pages']['types'][163]['showitem'] =
$GLOBALS['TCA']['pages']['types'][\TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_DEFAULT]['showitem']
. 'the list with your new fields';
This basically copies the fields from the default page type and adds them to your custom doktype.
Of course it's nicer to have the name of the page type in an XLIFF file and to have the doktype number as a constant in your code, but that's for you to add.
Based on the doktype you can render whatever the new fields are for.
Hopefully this was the complete list of settings for adding a page type :-)
I've special requirement on my project and I need help. I am using TYPO3 8.7.8. I've a custom extension to render tag labels in frontend. We can add the tags as TCA record in backend storage folder. In the TCA record, you can tag name. My requirement is, when I save the TCA record I want to create a TYPO3 page automatically with the same name as tag in a specific position. Everytime when I add a TCA record, I need to create corresponding page automatically. Is this possible? I can use hook while saving TCA. But is there any function to create pages automatically?
After automatic page creation, I want to insert a plugin content element in that page with a specific flexform value automatically. I know this is a strange requirement, but I would like to know if it is possible or not.
Exactly, you'd trigger a hook on saving and then as next step you can use the data handler to generate the new page (and possible content).
To create the page and content, use something like the following data structure
$data = [
'pages' => [
'NEW_1' => [
'pid' => 456,
'title' => 'Title for page 1',
],
],
'tt_content' => [
'NEW_123' => [
'pid' => 'NEW_1',
'header' => 'My content element',
],
],
];
Then call the datahandler with that structure:
$tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
$tce->stripslashes_values = 0;
$tce->start($data, []);
$tce->process_datamap();
Find out more in the docs at
https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Typo3CoreEngine/Database/Index.html#data-array
and
https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Typo3CoreEngine/UsingDataHandler/Index.html
Are you sure you need additional pages?
In general your problem sounds like you need one page where the plugin is inserted and where the plugin in dependency of an url-parameter (which can be converted with realurl into a path segment) shows only information depending of the selected record (tag).
If no tag is selected you can output a list with all available tags as a menu to navigate to all possible tags.
With a little effort (less than writing a hook like intended) you can add all tags to your menu.
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.
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.