Project

General

Profile

Actions

Bug #70904

closed

IRRE: foreign_record_defaults for colPos gets trimmed

Added by Sven Teuber over 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2015-10-21
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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'
)

> will set the colPos select field value to "-"

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.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #71293: `foreign_record_defaults` is not stored when the field hiddenClosed2015-11-03

Actions
Actions #1

Updated by Artus Kolanowski over 8 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.

Actions #2

Updated by Jo Hasenau over 8 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.

Actions #3

Updated by Artus Kolanowski over 8 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.

Actions #4

Updated by Mathias Schreiber over 8 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?

Actions #5

Updated by Artus Kolanowski over 8 years ago

I've tested this in the current master 173a8d3. It works! :)

Actions #6

Updated by Mathias Schreiber over 8 years ago

  • Status changed from Needs Feedback to Closed
Actions #7

Updated by Artus Kolanowski over 8 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.

Actions #8

Updated by Mathias Schreiber over 8 years ago

  • Status changed from Closed to New
Actions #9

Updated by Mathias Schreiber over 8 years ago

  • Assignee deleted (Mathias Schreiber)
Actions #10

Updated by Artus Kolanowski over 8 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.

Actions #11

Updated by Christian Kuhn over 8 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
Actions #12

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF