Skip to content

Plugins with CType list are not called #834

@andreaswolf

Description

@andreaswolf

Describe the bug
First of all: I'm still on EXT:headless v3, so maybe this is not an issue on v4; I have not checked that yet.

As said, the plugin is not called (due to missing TypoScript configuration, but this can easily be fixed on a per-plugin base, probably not so easy on a global base).

To Reproduce

  1. Have a plugin configured in CType list
  2. Return JSON in that plugin, either directly as a JsonResponse or via generating JSON in the Fluid template (cf. EXT:headless_news)

Expected behavior
The plugin is called and my content is part of the JSON object in PageData.

Screenshots
If applicable, add screenshots to help explain your problem.

TYPO3 version and TYPO3 Headless version
TYPO3 v11 and EXT:headless 3.x latest version

Additional context
It seems as if the JSON content object does not resolve the list_type field in the shipped default configuration. In the fluid_styled_content, this switch is also not done via the CASE cObject, but via the List cObject's template, which renders the relevant tt_content.list.20.<list_type> TS object.

I managed to get rendering working with this configuration:

tt_content.list = COA
tt_content.list.20 = CASE
tt_content.list.20 {
  key.field = list_type

  myextension_myplugin >
  myextension_myplugin =< lib.contentElement
  myextension_myplugin {
    fields.type = TEXT
    fields.type.field = list_type

    fields.content = USER
    fields.content {
      userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
      extensionName = MyExtension
      pluginName = MyPlugin
    }
  }
}

The action was changed to this:

[…]
        return $this->jsonResponse(json_encode(['foo' => 'bar'));
}

The return value of the action is then available as single properties in the content object, in my example T3CeMyextensionMyplugin:

<script setup lang=ts>
const props = defineProps<{
  foo: string,
}>()
</script>

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions