TYPO3 v4.6 about IRRE (sorting) - content-management-system

We must update the field data sorting sorting.
I set $TCA['tx_table2']['ctrl']['sortby'] = 'sorting';
And i set:
$TCA['tx_table1']['columns']['uid_records'] = array(
............
'config' => array(
'type' => 'inline',
'languageMode' => 'inherit',
'foreign_table' => 'tx_table2',
'foreign_sortby' => 'sorting',
'size' => 1,
'minitems' => 0,
'maxitems' => 100,
)
);
But when moving the recording position, the data field sorting is not updated.
Values are recorded only when creating a new record.
What could be the problem?

Related

Problem with TCA columns with foreign table after migrating from LTS 7 to LTS 8

I'm working in a old extension.
After migrating from LTS 7, I have "invalid values (1)" in each of my TCA select types, but the correct value is checked in the list.
All upgrade wizards are OK and Database compare too.
I am using a TCA column with foreign table like this:
$GLOBALS['TCA']['tx_myextension_model'] = array(
'columns' => array(
'diploma_type' => array(
'exclude' => 1,
'config' => array(
'type' => 'select',
'renderType' => 'selectSingle',
'MM' => 'sys_category_record_mm',
'MM_match_fields' => array(
'fieldname' => 'diploma_type',
'tablenames' => 'tx_extension_name',
),
'MM_opposite_field' => 'items',
'foreign_table' => 'sys_category',
'foreign_table_where' => ' AND (sys_category.sys_language_uid = 0 OR sys_category.l10n_parent = 0) AND pid = 35 ORDER BY title',
'size' => 10,
'autoSizeMax' => 20,
'minitems' => 0,
'maxitems' => 20,
'behaviour' => array(
'allowLanguageSynchronization' => true,
)
)
)
)
);
In the table tx_myextension_model.diploma_type TYPO3 save the value 1 and in sys_category_record_mm the correct value.
Any thoughts?

No selected items shown with selectMultipleSideBySide and MM_match_fields in TYPO3 TCA

This is my TCA:
tx_csblog_tags' => [
'exclude' => 0,
'label' => 'LLL:EXT:cs_blog/Resources/Private/Language/locallang_db.xlf:tx_csblog_domain_model_post.tags',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'tx_csblog_domain_model_tag',
'foreign_table_where' => ' ORDER BY tx_csblog_domain_model_tag.title ASC',
'MM' => 'tx_csblog_post_tag_mm',
'MM_match_fields' => [
'tablenames' => 'pages',
'fieldname' => 'tx_csblog_tags'
],
'nultiple' => 0,
'size' => 10,
'autoSizeMax' => 30,
'minitems' => 0,
'maxitems' => 9999,
The selected items are stored correct in the database table tx_csblog_post_tag_mm, e.g.
uid_local uid_foreign sorting sorting_foreign tablenames fieldname
143 18 1 0 pages tx_csblog_tags
If I save the record, the selected items will be stored in the database this way, but not shown again as selected. So if I save again, the relations are gone.
Did I miss something or is it not possible to use MM_match_fields like this?
Ok, if I leave the "tablenames" it works.

new content element at content wizard

I have some problems with typo 7.6.2
I would like to add my own content elements to the content-element wizard.
My own extension with templates, partials, TypoScript... worked and the element is visible in the content-element wizard.
Content-element Wizard
If I choose the new element and click the place to add the following screen is shown.
(ext_tables.php):
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
$_EXTKEY,
'Configuration/TypoScript',
'Template Extension'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('
mod {
wizards.newContentElement.wizardItems.extra {
header = KCW Inhalte
elements {
mitglied {
icon = ../typo3/sysext/core/Resources/Public/Icons/T3Icons/content/content-header.svg
title = Mitglied
description = Ein Mitglied anlegen
tt_content_defValues {
CType = mitglied
}
}
}
show = *
}
}
');
"Configuration/TCA/Overrides/tt_content.php":
$TCA['mitglied'] = array(
'columns' => array(
'name' => array (
'exclude' => 1,
'label' => 'Vorname Name',
'config' => array (
'type' => 'input',
'size' => '20'
)
),
'spitzname' => array (
'exclude' => 1,
'label' => 'Spitzname',
'config' => array (
'type' => 'input',
'size' => '20'
)
),
'geburtstag' => array (
'exclude' => 1,
'label' => 'Geburtstag',
'config' => array (
'type' => 'input',
'size' => '10',
'eval' => 'date',
)
),
'posten' => array (
'exclude' => 1,
'label' => 'Posten',
'config' => array (
'type' => 'select',
'renderType' => 'selectSingle',
'items' => array (
array('Mitglied'),
array('Präsident'),
array('Kassenwart'),
array('Vergnügungsausschuss'),
),
'size' => 1,
'maxitems' => 1,
)
),
'foto' => array (
'exclude' => 1,
'label' => 'Foto',
'config' => array(
'type' => 'group',
'internal_type' => 'file',
'allowed' => 'jpg',
'max_size' => 1000,
'uploadfolder' => 'uploads/pics/',
'show_thumbs' => 1,
'size' => 3,
'minitems' => 1,
'maxitems' => 1,
'autoSizeMax' => 10,
)
),
),
'types' => array(
'0' => array('showitem' => 'name,spitzname,geburtstag,posten,foto')
)
);
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['tt_content'], $tcaTtContent);
I think the problem is located in these lines in ext_tables.php:
tt_content_defValues {
CType = mitglied
}
You have to allow the value mitglied as value of the field cType. The tt_content_devValues just sets the default values for the newly created content element.
TCEFORM.tt_content.cType.addItems.mitglied = Field title
https://docs.typo3.org/typo3cms/TSconfigReference/PageTsconfig/TCEform/Index.html#pagetceformconfobj

FAL saving image in backend module does not set the uid_local

I have a backend module that does some data transfer from an old 'profile' database to TYPO3.
For the images, I first renamed them and placed them in a storage.
The records of the profiles also have been copied and are stored in the DB.
I then get the file information of each file that is in the storage for a profile
$file = $storage->getFile($filetoget['filename']);
and gives me just what i need.
I then create a new file reference object:
$profilemedia = $this->objectManager->get('TYPO3\Regprofiler\Domain\Model\FileReference');
I can add all properties to this object that i need.
I also set:
$profilemedia->setUidLocal($fileProps['uid']);
when I then add the image to my profile and update my profile repository, all file refrences get stored as expected, EXCEPT the uid_local, this stays 0
what is annoying, because this way I don't get a reference to the sys_file and therefore: no image.
So why don't I get the uid_local stored ?
my TCA for the image
'image' => array(
'exclude' => 1,
'label' => 'image',
'l10n_mode' => 'mergeIfNotBlank',
'config' => array(
'type' => 'inline',
'foreign_sortby' => 'sorting',
'foreign_table' => 'tx_regprofiler_domain_model_profiler',
'foreign_field' => 'parent',
'size' => 5,
'minitems' => 0,
'maxitems' => 99,
'appearance' => array(
'collapseAll' => 1,
'expandSingle' => 1,
'levelLinksPosition' => 'bottom',
'useSortable' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
'showAllLocalizationLink' => 1,
'showSynchronizationLink' => 1,
'enabledControls' => array(
'info' => FALSE,
)
)
)
),
Please make sure, before creating a module to generate your data, that you can create the database-records using the TYPO3-Backend. Simply add a record and check if you can add an Image there. If it appears, you have an error in your module, else you have an error in your TCA.
It is also recommended using
$TCA['tx_yourext_domain_model_yourmodel']['columns']['image']['config'] =
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('yourImageFieldHere',
array(
'maxitems' => 1,
'appearance' => array(
'createNewRelationLinkTitle' => 'LLL:EXT:nwb_page_tools/Resources/Private/Language/locallang_customlabels.xlf:add_image'
)
),
'jpg,png'
);
in your TCA definition. This is a core method wich can be reviewed here

Typo3, TCA forms view depending on the chosen option

I have made in backend a TCA form, what will change depending of the value in select field "type":
This select field contains basically the options:
rte text
url
picture
I can make the system working so, that when "rte text" is chosen, it shows specified fields for "rte text", when url is chosen it shows specified fields for "url" etc..
In my case the content is always saved in database in field "content" and the selected type is saved in field "type".
My problem is that I have not found a way to change the "content" form field / configuration, depending on the selected type.
For example when I choose "rte text" it should use for the content field this kind of configuration (rich text editor):
'content' => array (
'exclude' => 0,
'label' => 'Content',
'config' => array (
'type' => 'text',
'cols' => '30',
'rows' => '5',
'wizards' => array(
'_PADDING' => 2,
'RTE' => array(
'notNewRecords' => 1,
'RTEonly' => 1,
'type' => 'script',
'title' => 'Full screen Rich Text Editing|Formatteret redigering i hele vinduet',
'icon' => 'wizard_rte2.gif',
'script' => 'wizard_rte.php',
),
),
)
),
and when I choose "picture" it should use for the content field this kind of configuration (file uploader):
'content' => array (
'exclude' => 0,
'label' => 'Content',
'config' => array (
'type' => 'group',
'internal_type' => 'file',
'allowed' => '',
'disallowed' => 'php,php3',
'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'],
'uploadfolder' => 'uploads/tx_uploadshere',
'size' => 1,
'minitems' => 0,
'maxitems' => 1,
)
),
Is there a way to change that configuration depending of the value in the selectbox. I have tried to put two contents in an array but haven't got it working on that way.
Unfortunately you cannot change the properties of a single field via type.
You can however influence what's being displayed. So you can configure two independent fields and switch the display:
ext_tables.php:
$TCA['tx_yourextension_yourtable'] = array(
'ctrl' => array(
//...
'type'=>'type',
//...
),
);
TCA.php:
$TCA['tx_yourextension_yourtable'] = array(
'ctrl' => $TCA['tx_yourextension_yourtable']['ctrl'],
'types' => array(
0 => array('showitem' => 'content_rte'),
1 => array('showitem' => 'content_image'),
),
'columns' => array(
'content_rte' => array(
'exclude' => 0,
'label' => 'Content',
'config' => array(
'type' => 'text',
'cols' => '30',
'rows' => '5',
'wizards' => array(
'_PADDING' => 2,
'RTE' => array(
'notNewRecords' => 1,
'RTEonly' => 1,
'type' => 'script',
'title' => 'Full screen Rich Text Editing|Formatteret redigering i hele vinduet',
'icon' => 'wizard_rte2.gif',
'script' => 'wizard_rte.php',
),
),
)
),
'content_upload' => array(
'exclude' => 0,
'label' => 'Content',
'config' => array(
'type' => 'group',
'internal_type' => 'file',
'allowed' => '',
'disallowed' => 'php,php3',
'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'],
'uploadfolder' => 'uploads/tx_uploadshere',
'size' => 1,
'minitems' => 0,
'maxitems' => 1,
)
),
),
// ...
);
(Note: I've removed system fields like hidden, sys_language_uid etc. for simplicity's sake)