TYPO3-Headless / headless

TYPO3 Headless JSON API providing content for PWA application (e.g. javaScript apps like nuxt-typo3)
https://t3headless.io
GNU General Public License v2.0
160 stars 61 forks source link

Image, Textpic and Textmedia content elements not rendered. #225

Closed jzscheile closed 3 years ago

jzscheile commented 3 years ago

I've setup a fresh Typo3 10.4LTS installation and inserted some content elements, as well Image, Textpic and Textmedia. Text content elements was rendered as expected and shown as in the examples mention, but Image, Textpic and Textmedia wasn't rendered and not part of the JSON output.

My environment: what version
PHP 7.4.13
Typo3 10.4.12
ext:headless 2.3.0
ext:headless_gridelements 1.0.4
ext:gridelements 10.0.0

Output: { "position": { "horizontal": "center", "vertical": "above", "noWrap": false }, "width": 600, "count": { "files": 1, "columns": 1, "rows": 1 }, "columnSpacing": 10, "border": { "enabled": false, "width": 2, "padding": 0 }, "rows": { "1": { "columns": { "1": { "media": {}, "dimensions": { "width": 600, "height": 386 } } } } } },

In JsonContentObject.php (line 81-86) I've found following lines:

if (isset($conf['fields.'])) {
    $data = $this->cObjGet($conf['fields.']);
}
if (isset($conf['dataProcessing.'])) {
    $data = $this->processFieldWithDataProcessing($conf);
}

Problem seems the origin data processing instruction from the core extension fluid_styled_contend, in the Typoscript are as well data processors defined (tt_content.textpic.dataProcessing).

After clear them by Typoscript:

tt_content.image.dataProcessing >
tt_content.textmedia.dataProcessing >
tt_content.textpic.dataProcessing >

The content elements are rendered and shown in the outputted JSON and output is: { "id": 7, "pid": 1, "type": "textpic", "colPos": 1, "categories": "", "appearance": { "layout": "default", "frameClass": "default", "spaceBefore": "", "spaceAfter": "" }, "content": { "header": "Text & Image", "subheader": "", "headerLayout": 3, "headerPosition": "", "headerLink": "", "bodytext": "<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>", "gallery": { "position": { "horizontal": "center", "vertical": "above", "noWrap": false }, "width": 600, "count": { "files": 1, "columns": 1, "rows": 1 }, "columnSpacing": 10, "border": { "enabled": false, "width": 2, "padding": 0 }, "rows": { "1": { "columns": { "1": { "publicUrl": "http://typo3.headless.local/fileadmin/user_upload/755e9798cc02d4e8594a5aa08e9207ae.png", "properties": { "title": null, "alternative": null, "description": null, "mimeType": "image/jpeg", "type": "image", "filename": "755e9798cc02d4e8594a5aa08e9207ae.png", "originalUrl": "fileadmin/user_upload/755e9798cc02d4e8594a5aa08e9207ae.png", "uidLocal": 2, "fileReferenceUid": 2, "size": "93 KB", "link": null, "dimensions": { "width": 1008, "height": 650 }, "cropDimensions": { "width": 1008, "height": 650 }, "crop": { "default": { "cropArea": { "x": 0, "y": 0, "width": 1, "height": 1 }, "selectedRatio": "NaN", "focusArea": null } }, "autoplay": null, "extension": "png" } } } } } } } },

The execution of $conf['dataProcessing.'] overrides the before executed $conf['fields.'].

I hope I have not overlooked anything and it is my fault.

Best, Jens

jzscheile commented 3 years ago

Hi,

I've found my fault. The TS for Fluid Content Elements was as well included, which makes absolutely no sense if I want to have JSON output :-D .

So it was my fault and issue can be closed.

Best, Jens