Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Content Blocks on TYPO3 Version 13 #751

Open
stattmal opened this issue Jul 12, 2024 · 12 comments
Open

Error with Content Blocks on TYPO3 Version 13 #751

stattmal opened this issue Jul 12, 2024 · 12 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@stattmal
Copy link

Describe the bug
Trying the TYPO3 Headless API on a new TYPO3 version 13, including the new TYPO3 CMS Content Blocks extension, results in an error when requesting the JSON response.

To Reproduce
Steps to reproduce the behavior:

  1. Perform a fresh TYPO3 13.2.1 installation.
  2. Add a new content block with the following command:
    typo3/sysext/core/bin/typo3 make:content-block --content-type="content-element" --vendor="my-vendor" --name="my-first-content-element" --title="My shiny new Content Element" --extension="my-extension"
    
  3. Add the content block as content on a new page.
  4. Try to load the JSON response.
  5. See error.

Expected behavior
A JSON response with the newly added content based on the content blocks.

Screenshots
Screenshot 2024-07-12 at 18 29 49

TYPO3 version and TYPO3 Headless version

  • TYPO3: 13.2.1
  • TYPO3 Headless API: 4.3.2
  • TYPO3 CMS Content Blocks: 0.8.0

Additional context
We have been using your headless plugin for a while and would love to have support for TYPO3 version 13 when requesting new content blocks.

@stattmal stattmal added the bug Something isn't working label Jul 12, 2024
@twoldanski
Copy link
Collaborator

Hi @stattmal I have this on roadmap for new major version of our extension, but for I have to wait for final API in core to start adapting it for ext:headless

@twoldanski twoldanski added the enhancement New feature or request label Jul 15, 2024
@tmotyl
Copy link
Collaborator

tmotyl commented Jul 15, 2024

but feel free @stattmal to send PR

@cehret
Copy link

cehret commented Aug 16, 2024

howto get headless running with TYPO3 13?
I set up a new composer based TYPO3 13.2.1 - downloaded the last master from headless and changed the dependencies to TYPO3 13.2. So I could install headless but the backend results in 500 Error.
@tmotyl is there a release plan for headless for TYPO3 13.2 ?

@twoldanski
Copy link
Collaborator

twoldanski commented Sep 23, 2024

@cehret you can test now headless with v13 on branch t3v13 (based on v4.4 with added v13 support) see more at #778

@carsten-wilhelm
Copy link

I still get this with TYPO3 v13.4.0 and headless 4.5.0.

In JSON, I only have

content: "Oops, an error occurred! Request: d6adf10b3e734",

And in logfile warnings:

Exception: PHP Warning: Trying to access array offset on null in /var/www/html/app/vendor/friendsoftypo3/headless/Classes/ContentObject/JsonContentContentObject.php line 186, in file /var/www/html/app/vendor/typo3/cms-core/Classes/Error/ErrorHandler.php:141

@twoldanski
Copy link
Collaborator

Hi @carsten-wilhelm most probably, with release v4.5.0 we added support for v13, content block extension is not supported at the moment.

@cehret
Copy link

cehret commented Nov 11, 2024

Hi @carsten-wilhelm most probably, with release v4.5.0 we added support for v13, content block extension is not supported at the moment.

Any plans for supporting the content block extension?

@oooFreaKooo
Copy link

@cehret Im using content blocks without any issues. I got into one recently but I got it fixed for now. Here was my solution: #801

I also got a Typoscript generator, which generates the Typoscript file for the config.yaml using a command.
With my setup you only need to write the config file. Let me know if you want me to share it.

@carsten-wilhelm
Copy link

I disabled colPos grouping.

Good news: error has disappeared.

Bad news: I know why - the content block I created is not part of JSON, instead I only see a "null" value. This is the root cause of the initial error, since there is no colPos in null (obviously) and grouping just fails.

Not sure if I did something wrong with the content block or why it is not appearing in JSON at all.

@twoldanski
Copy link
Collaborator

Hi @carsten-wilhelm because, it is not fault of ext:headless per se, but contentblocks. They are not designed to work with headless out-of-box, they are designed for working with fluid templates, and also have different philosophy and approach to handle certain things. AFAIK, contentblocks try to avoid TypoScript as much as possible, in contrast we depend on it, because our implementation is based on TypoScripts' content objects.

To work with ext:headless we need layer to handle of content blocks in headless context. I see that, we have two possible ways to handle it (I have some PoCs, but not finished) one is fix TypoScript generation, second is to create extra data processing of content blocks for headless (but it is not perfect also)

@carsten-wilhelm
Copy link

Hi @twoldanski
I opened a ticket in the content-blocks issues as well - the response was that this is based on TYPO3 Core (doesn't sound like they will do changes to content-blocks), see FriendsOfTYPO3/content-blocks#348 (comment)

But: I am not the first one to encounter that and found an extension that seems to provide the data processing. At least in my minimal prrof of concept, it works as expected.
https://extensions.typo3.org/package/netzbewegung/nb-headless-content-blocks

@twoldanski
Copy link
Collaborator

twoldanski commented Feb 17, 2025

@carsten-wilhelm Exactly, content blocks are not designed to support headless approach, we need to add support.
I saw this extension, this is implementation of one of my approaches (I saw they had same idea), but it still need to handle more things, to be honest I see some nice possible features in this approach, but on the other hand in most cases it will be an overkill doing this way, so still thinking about best approach to handle content blocks in headless context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants