Skip to content

allowedRecordTypes is not overwriting allowedContentTypes #501

Description

@Denneee

Describe the bug
I have a backend layout that restricts content using the new setting allowedContentTypes.
I’m trying to create a nested content element (an accordion), but when I save it, I get an error saying that the CType is not allowed. I seam to not be able to overwrite the backend layout setting allowedContentTypes with allowedRecordTypes.

To Reproduce
Steps to reproduce the behavior:

  1. Create a backend layout and a page that is using this backend layout
mod.web_layout.BackendLayouts.default {
  title = Default
  config {
    backend_layout {
      colCount = 1
      rowCount = 1
      rows {
        0 {
          columns {
            1 {
              name = Main
              colPos = 0
              identifier = main
              allowedContentTypes := addToList(fv_accordion)
              allowedContentTypes := addToList(div)
              allowedContentTypes := addToList(shortcut)
            }
          }
        }
      }
    }
  }
}
  1. Create the Content Element

Config.yaml

name: fv/accordion
typeName: fv_accordion
group: fv
prefixFields: true
prefixType: vendor
vendorPrefix: tx_basis
fields:
  - identifier: accordion_item
    type: Collection
    minitems: 1
    fields:
      - identifier: headline
        type: Text
        required: true
      - identifier: content
        type: Collection
        foreign_sortby: sorting
        foreign_table: tt_content
        shareAcrossFields: true
        shareAcrossTables: true
        allowedRecordTypes:
          - text
          - div

backend-preview.html

<f:layout name="Preview"/>
<f:section name="Header">
</f:section>

<f:section name="Content">
    <f:for each="{data.accordion_item}" as="item">
            <h3>{item.headline}</h3>
            <f:render partial="PageLayout/Grid" arguments="{data: item, identifier: 'content'}"/>
        </f:for>
</f:section>

  1. Got to the created page and insert the content element
  2. Try to create a content from type text
  3. Save the Content Element
  4. See Error: This action could not be completed; please contact your administrator. Technical details: 1: The record "tt_content:174" with CType "text" in colPos "0" couldn't be saved due to disallowed value(s).
  5. When I delete the allowedContentTypes in the backend layout or change the colPos to something different then 0, everything is working as expected.

Expected behavior
I can save the content and see the related content element in the backend preview. The setting allowedRecordTypes is overwriting the setting allowedContentTypes for this element correctly.

TYPO3 Version
v14.2
also in v13.4 with content_defender extension/syntax

Content Blocks Version:
2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions