I'm trying to create my own TCA field user type to simply display some data in the typo3 backend of an objects child/children.
The thing is that when I fetch the children by query builder I would be returned an array with id's for its children instead of e.g. the title as defined in the tca of that object. As I want to display not the id but e.g. the title of that childs child I am stuck with a problem I don't know how to solve.
I've tried looking at the classes for the select elements (inline too) but when copying the beginning of the render function of it I already run into an "array key not defined" error for "items" (which is optional if a foreign_table is defined). The class I copied it from was \TYPO3\CMS\Backend\Form\Element\SelectSingleElement which I found by searching for AbstractFormElement which my class extends from too.
To make it clearer on what I want to achieve there's an example (I only used the parts that are important):
object1_tca.php:
'columns' => [
'object1' => [
'label' => 'object1',
'config' => [
'type' => 'user',
'renderType' => 'showChildData',
'foreign_table' => 'tx_ext_domain_model_object2',
'foreign_field' => 'object1',
'render_settings' => [
'childFields' => 'object3'
],
],
]
]
object2_tca.php:
'ctrl' => [
'title' => 'object2',
'label' => 'name',
'label_alt' => 'object3',
'label_alt_force' => true,
],
'columns' => [
'object3' => [
'label' => 'object3',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'tx_ext_domain_model_object3',
'foreign_field' => 'object2',
],
],
]
object3_tca.php:
'ctrl' => [
'title' => 'object3',
'label' => 'name',
]
So the objects relations are as follows:
------------ ------------
| object 1 | ----- 1:m ----→ | object 2 |
------------ ------------
------------ ------------
| object 2 | ----- m:1 ----→ | object 3 |
------------ ------------
So, object2 will display as title its own name and the name of object3 that is selected. If I would change the field object2 of object1 configuration to a single select, I would also get that title for that child.
But I don't know how to fetch that title or that object2 data in my user type field.
In the end I want to do more with the data, group them by e.g. some field aso. This should also be applicable for different objects, so it's not the same repository or objects for the fields I want to use them for.
Can anyone help me? Is this even possible without having to fetch the children and the childrens children aso. from the database?
If you need more information I will provide whatever I can :) Any help is welcome. I feel like this should be easy but I'm stuck with even knowing where to look anymore. Thanks.