TYPO3 TCA selectMultiple config - typo3

I've an issue wit TYPO3 selectField, selectMultipleSideBySide.
I've configure the field like this:
$tmpColumns = [
'tx_tcademo_list' => [
'label' => 'Items',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'tx_tcademo_domain_model_item',
'MM' => 'tx_tcademo_record_item_mm',
'MM_hasUidField' => true,
'MM_match_fields' => [
'tablenames' => 'fe_users',
'fieldnames' => 'tx_tcademo_items',
],
'minitems' => 0,
'maxitems' => 99999,
],
],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('fe_users', $tmpColumns);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('fe_users', 'tx_tcademo_list');
Issue is:
The field is added to fe_users correctly, and items can be selected as expected, and they're saved to db MM relation, but when form is redrawn, the selected items are not marked as selected, and will be overwritten with next save.
Link to extension which demonstrates the issue:
TCA Demo extension

Related

custom content element containing child elements of type inline with fields of tt_content(image, header) in TYPO3 9? TCA, Domain model needed?

I want to make a custom content element, just with TYPO3 v9.5 core, that has custom content elements of type inline (children elements). Each of them has the fields header and image from tt_content.
So what I got already is this:
custom content element with inline child
Expanding the child element by clicking on it, I get something like this:
expanded child element with image and header field
So far, so good, but why are my childrens not in the parent element when I am looking at my page content:
I want them childrens to be in the parent container, but they are next to it.
And my other question would be, how can I get the parent element with all its children into fluid, so that I can loop over the childrens and for example output them as list items. All children have the UID of the parent.
And pls dont tell me to use extensions... I wanna learn TYPO3 and build it with TYPO3 core :) for the sake of practicing.
This is how my tt_content in TCA/overrides looks like:
Sorry for the variable names.... but Iam struggling hard. It might be a bit hard to understand:
'tt_content',
'CType',
['custom element', 'portfolio_list', 'content-text'],
'textmedia',
'after'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
'tt_content',
'CType',
['custom element', 'portfolio_list2', 'content-text'],
'textmedia',
'after'
);
// $GLOBALS['TCA']['tt_content']['types']['portfolio_list'] = [
// 'showitem' => '
// --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
// --palette--;;general,
// image; Image,
// header; Title,
// bodytext; Schreiben Sie einen Text,
// --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
// --palette--;;hidden,
// --palette--;;access,
// ',
// 'columnsOverrides' => [
// 'bodytext' => [
// 'config' => [
// 'enableRichtext' => true,
// 'richtextConfiguration' => 'default',
// ],
// ],
// ],
// ];
$GLOBALS['TCA']['tt_content']['types']['portfolio_list2'] = [
'showitem' => '
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
--palette--;;general,
image; Image,
header; Title,
portfolio_list2;Elemente,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
--palette--;;hidden,
--palette--;;access,
',
'columnsOverrides' => [
'bodytext' => [
'config' => [
'enableRichtext' => true,
'richtextConfiguration' => 'default',
],
],
'portfolio_list2' => [
'exclude' => true,
'label' => 'Einzelnes-Portfolio',
'config' => [
'type' => 'inline',
'allowed' => 'tt_content',
'foreign_table' => 'tt_content',
'foreign_sortby' => 'sorting',
'foreign_field' => 'portfolio_list',
'minitems' => 0,
'maxitems' => 99,
'appearance' => [
'collapseAll' => true,
'expandSingle' => true,
'levelLinksPosition' => 'bottom',
'useSortable' => true,
'showPossibleLocalizationRecords' => true,
'showRemovedLocalizationRecords' => true,
'showAllLocalizationLink' => true,
'showSynchronizationLink' => true,
'enabledControls' => [
'info' => false,
],
],
],
],
],
];
// $GLOBALS['TCA']['tt_content']['columns']['header']['config']=[
// 'type' => 'inline',
// 'foreign_table' => 'tt_content',
// 'foreign_field' => 'header',
// 'foreign_sortby' => 'sorting',
// 'maxitems' => 9999,
// 'appearance' => [
// 'collapseAll' => 0,
// 'levelLinksPosition' => 'top',
// 'showSynchronizationLink' => 1,
// 'showPossibleLocalizationRecords' => 1,
// 'useSortable' => 1,
// 'showAllLocalizationLink' => 1
// ]
// ];
// $GLOBALS['TCA']['tt_content']['columns']['bodytext']['config']=[
// 'type' => 'inline',
// 'foreign_table' => 'tt_content',
// 'foreign_field' => 'header',
// 'foreign_sortby' => 'sorting',
// 'maxitems' => 9999,
// 'appearance' => [
// 'collapseAll' => 0,
// 'levelLinksPosition' => 'top',
// 'showSynchronizationLink' => 1,
// 'showPossibleLocalizationRecords' => 1,
// 'useSortable' => 1,
// 'showAllLocalizationLink' => 1
// ]
// ];
// $GLOBALS['TCA']['tt_content']['columns']['image']['config']=[
// 'type' => 'inline',
// 'foreign_table' => 'tt_content',
// 'foreign_field' => 'image',
// 'foreign_sortby' => 'sorting',
// 'maxitems' => 9999,
// 'appearance' => [
// 'collapseAll' => 0,
// 'levelLinksPosition' => 'top',
// 'showSynchronizationLink' => 1,
// 'showPossibleLocalizationRecords' => 1,
// 'useSortable' => 1,
// 'showAllLocalizationLink' => 1
// ]
// ];
$temporaryColumn = [
'portfolio_list2' => [
'exclude' => true,
'label' => 'Einzelnes-Portfolio',
'config' => [
'type' => 'inline',
'allowed' => 'tt_content',
'foreign_table' => 'tt_content',
'foreign_sortby' => 'sorting',
'foreign_field' => 'portfolio_list',
'minitems' => 0,
'maxitems' => 99,
'appearance' => [
'collapseAll' => true,
'expandSingle' => true,
'levelLinksPosition' => 'bottom',
'useSortable' => true,
'showPossibleLocalizationRecords' => true,
'showRemovedLocalizationRecords' => true,
'showAllLocalizationLink' => true,
'showSynchronizationLink' => true,
'enabledControls' => [
'info' => false,
],
],
],
],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'tt_content',
$temporaryColumn
);
// $customImage = [
// 'portfolio_list' => [
// 'exclude' => true,
// 'label' => 'Einzelnes-Portfolio',
// 'config' => [
// 'type' => 'inline',
// 'foreign_table' => 'tt_content',
// 'foreign_field' => 'teaser_field',
// 'foreign_sortby' => 'sorting',
// 'maxitems' => 9999,
// 'appearance' => [
// 'collapseAll' => 0,
// 'levelLinksPosition' => 'top',
// 'showSynchronizationLink' => 1,
// 'showPossibleLocalizationRecords' => 1,
// 'useSortable' => 1,
// 'showAllLocalizationLink' => 1
// ],
// ],
// ],
// ];
// \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $customImage);
Do I need Domain Models and make a 1:n relation or something like that? Sorry, for stupid questions. I am 2.5 months into TYPO3 and I just start my career in coding :)
I would be so thankful for any kind of help :) THX a lot!
What you need to get the content element values in the FrontEnd, is DataProcessing. DataProcessing is basically an SQL query done by TypoScript. Here you can find a detailed Tutorial on how to build custom elements. There is a section which explains the DataProcessing with an example.
How to create custom content elements on TYPO3
Here is the official documentation
DataProcessing
As for the children that are being shown in the backend, you can hide them by creating a Hook for the Plugin preview. In the article i send you, there is a detailed explanation on how you can create the hook. it is called "The PageLayoutView Hook" Here is the official documentation
Configure Custom Backend Preview for Content Element
Once you created the class, in order to hide the children, you will have to add this:
New hook to determine if content record is used/unused
What you need to do, is either leave the children on colPos=0 and edit the function to return $record['colPos'] === 0 or you can create a new Backend Field on your layout, give it the 999 colPos number (or any number you want, it doesnt really matter) and leave the function as is. But you have to remember, when a new child is created, you have to give it automatically the colPos defined on your function, otherwise the editor will have to manually select the colPos 999 every single time. You can achive that by editing this to your needs:
$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['content_elements']['config']['overrideChildTca']['columns']['colPos']['config']['default'] = '1';
Hope it helped. Any other questions, feel free to ask
Best regards

TYPO3 Delete FileReference as non admin

I can't figure out which setting I have to activate to allow non-admin users to delete file references in the backend.
As admin I have that little trash icon which is missing when logged in as non-admin user.
I set every single flag to allow data manipulation in the backend users module but nothing worked so far. The only option is to give the user admin privileges. What do I miss?
Edit:
I am on TYPO3 10.4
Edit:
TCA for field:
'image' => [
'exclude' => true,
'label' => 'Image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'image',
[
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference'
],
'foreign_types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
]
],
'foreign_match_fields' => [
'fieldname' => 'image',
'tablenames' => 'tx_association_domain_model_association',
'table_local' => 'sys_file',
],
'maxitems' => 1,
'minitems' => 0
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],

Typo3 10 TCA "'type' => 'inline'," create new relation and upload button auto hide

After upload and save 1 relation/file, the "create new relation" and "select and upload" button is not showing. Due to that issue, I am unable to update that attached file or edit the record.
Below are the TCA configuration code for that field:
'catalogs' => [
'exclude' => 1,
'label' => 'catalogs',
'config' => [
'type' => 'inline',
'foreign_table' => 'catalog',
'appearance' => [
'collapseAll' => 1,
'expandSingle' => 1,
'newRecordLinkAddTitle' => 0,
],
'foreign_field' => 'supplier',
'minitems' => 0,
'maxitems' => 5,
]
],
Thanks in advance.
That was a bug introduced with TYPO3 v10.4.11 and fixed in 10.4.13:
https://forge.typo3.org/issues/93091
Please update your TYPO3 to the latest version.

Problem with file upload TCA after upgrading to TYPO3 10

On typo3v9 i had working file upload field with this TCA configuration:
'image' => [
'exclude' => 0,
'label' => 'image upload',
'config' => [
'type' => 'group',
'internal_type' => 'db',
'uploadfolder' => 'uploads/folder',
'show_thumbs' => 1,
'size' => 5,
'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
'disallowed' => '',
],
],
i get this result:
but after migration to typo3v10 it does not work properly and give this result:
Someone have working solution for single file upload field?
I guess you mean internal_type=file ? That's deprecated. Here an example for image upload. However you can allow other types here too, I am sure you can find more info on that.
'photos' => [
'exclude' => true,
'label' => 'LLL:EXT:xxx/Resources/Private/Language/locallang_db.xlf:tx_xxx_domain_model_activity.photos',
'config' =>
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'photos',
[
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference'
],
'foreign_types' => [
'0' => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
]
],
'maxitems' => 30
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],

Where to influence in which languages an extbase record can be translated?

In a custom built TYPO3 extension, records are only available in language -1 in the backend. That was specified as such, but should now be changed so records can be translated.
Something is missing. I thought this would be in TCA, but the definitions look quite normal:
'columns' => [
'sys_language_uid' => [
'exclude' => true,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'special' => 'languages',
'items' => [
[
'LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages',
-1,
'flags-multiple'
]
],
'default' => 0,
],
],
'l10n_parent' => [
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => true,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['', 0],
],
'foreign_table' => 'tx_myext_domain_model_item',
'foreign_table_where' => 'AND tx_myext_domain_model_item.pid=###CURRENT_PID### AND tx_myext_domain_model_item.sys_language_uid IN (-1,0)',
],
],
Also, when I change TCA, for example change config as such:
'config' => array(
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array(
array('LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0)
),
),
It's still the same: only language -1 (ALL) is selectable.
Of course, the sysfolder those records are on is translated in multiple languages. Also, the columns for sys_language_uid, l10n_parent and l10n_diffsource are present in the database.
Are the other languages maybe disabled somewhere? Where else could I look?
Or which element could be missing else to make records translateable?
Thanks for any hint.