Bug #70904
closedIRRE: foreign_record_defaults for colPos gets trimmed
100%
Description
TYPO3 7.5
Use-case:
Referencing tt_content in IRRE elements, the child elements pop up in the standard content area due to them having the same colPos as the parent element. If only you could assign the IRRE children some other colPos to hide them (like, 1 if gridelements is installed ;))!
Issue:
If you configure an inline element in the TCA and try to set the colPos using the foreign_record_defaults array, the colPos-value gets trimmed to the first character.
Example:
TCA:
'myColumn' => array(
'exclude' => 1,
'label' => 'IRRE relation to tt_content',
'config' => array(
'type' => 'inline',
'foreign_table' => 'tt_content',
'foreign_field' => 'tx_myext_irre_parent',
'foreign_record_defaults' => array(
'colPos' => '56'
)
),
),
this will set the colPos select field in the newly created IRRE element to "5"
'foreign_record_defaults' => array(
'colPos' => '-1'
)
There seems to happen a trim of the value down to the first character. It happens here somewhere:
typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php, line 290:
$nodeFactory = GeneralUtility::makeInstance(NodeFactory::class);
$childArray = $nodeFactory->create($formData)->render();
While in $formData['inlineRelatedRecordToRender'], the colPos-value is still intact,
it is trimmed down to the first character in the returned $childArray
I think the value shouldn't be trimmed, but left untouched.
Updated by Artus Kolanowski about 9 years ago
Confirmed! It happens in sysext/backend/Classes/Form/Element/SelectSingleElement.php:L112
. This was added in https://git.typo3.org/Packages/TYPO3.CMS.git/commit/b524fc860c96077eabe6adb6fc9d0eab197aea9e. But I have not tested if it was working before.
Updated by Jo Hasenau about 9 years ago
I can confirm that this has been working before, since we have used exactly that trick to fix #58847 and it works with TYPO3 6.2 and the GE 3-0 branch.
Updated by Artus Kolanowski about 9 years ago
Another problem in this context is, but it might be already related to another ticket: When you use foreign_record_defaults
for a type field, the the defined value (currently only with a length of one), is correctly selected but the related types
configuration is not shown/rendered. So the editor has to reselect the type manually through the drop down to get form fields rendered.
Updated by Mathias Schreiber about 9 years ago
- Status changed from New to Needs Feedback
- Assignee set to Mathias Schreiber
We are 99% certain this is fixed on current master.
Can you please retry?
Updated by Artus Kolanowski about 9 years ago
I've tested this in the current master 173a8d3
. It works! :)
Updated by Mathias Schreiber about 9 years ago
- Status changed from Needs Feedback to Closed
Updated by Artus Kolanowski about 9 years ago
Sorry I was wrong! The value is no longer trimed, but after saving the parent record the default value is stored and not the one defined in the foreign_record_defaults
. In my case I've used a type field. So I create a new inline record with the foreign_record_defaults => array('type' => 'foo')
. The default value for type
is bar
. After saving the parent record the type value of the created inline record is bar
and not foo
.
Updated by Mathias Schreiber about 9 years ago
- Status changed from Closed to New
Updated by Mathias Schreiber about 9 years ago
- Assignee deleted (
Mathias Schreiber)
Updated by Artus Kolanowski about 9 years ago
I've created a new issue after my last comment (https://forge.typo3.org/issues/71293) because I would say this issue is indeed resolved. This means the values seems to be no longer trimmed. So please excuse for bringing some confusion in here.
Updated by Christian Kuhn about 9 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed