Skip to content
New issue

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

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

Already on GitHub? # to your account

Using palettes in TCA with select inside is not working #332

Open
PLACEBOBRO opened this issue Jan 15, 2025 · 4 comments
Open

Using palettes in TCA with select inside is not working #332

PLACEBOBRO opened this issue Jan 15, 2025 · 4 comments
Labels
Support Support on how to use functionalities

Comments

@PLACEBOBRO
Copy link

PLACEBOBRO commented Jan 15, 2025

I encountered an issue with basics and "normal" TCA.
I created a palette in the Basics folder with the following configuration:

identifier: bt/palette_header
fields:
  - identifier: basics_palette_header
    type: Palette
    fields:
      - identifier: header
        useExistingField: true
      - type: Linebreak
      - identifier: header_layout
        useExistingField: true
      - identifier: textfeld
        type: Text
      - identifier: tx_basetemplateelements_bt_header_style
        label: 'LLL:EXT:base_template/ContentBlocks/Basics/Source/Language/Labels.xlf:tx_basetemplateelements_bt_header_style.label'
        type: Select
        renderType: selectSingle
        items:
          - label: LLL:EXT:base_template/ContentBlocks/Basics/Source/Language/Labels.xlf:tx_basetemplateelements_bt_header_style.items.0.label
            value: 0
          - label: 'H1'
            value: 1
          - label: 'H2'
            value: 2
          - label: 'H3'
            value: 3

Here my TCA:

$GLOBALS['TCA']['tt_content']['types']['container-1col']['showitem'] = '
        --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
         --palette--;;basics_palette_header,
         tx_basetemplate_backgroundcolor,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
         --palette--;;bt_frames,
 		--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
          --palette--;;language,
        --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
          --palette--;;hidden,
          --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,
        --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended
    ';

if I use the palette in a normal content block element, there is no issue.
However, if I want to add the palette via normal TCA to a content element which isn't created with content blocks (in this case to a container) this is not working. I get the following error because of the select inside the Basic:
image
All other fields are rendered correctly (e.g. Text)

I also found out, that using e.g. a checkbox with renderType: checkboxToggle, a normal checkbox is rendered, due to the fact, that maybe checkbox has a default renderType set and select doesn't?

TYPO3 13.4.2
content-blocks v. 1.1.4
PHP 8.3

@nhovratov
Copy link
Contributor

@PLACEBOBRO This won't work this way.

First: A Basic is not a Palette. This means if the Basic is not in use, it won't generate any TCA at all.

Second: You can't go "one level down" with Content Blocks. Everything defined in Content Blocks should only be used in there. If you need low level TCA, you have to define the fields and palettes in pure TCA and re-define it in Content Blocks.

My tip: Define your Container as a Content Block and simply use your Basic with the Palette like normal. See guide here: b13/container#546 (comment)

@nhovratov nhovratov added the Support Support on how to use functionalities label Jan 15, 2025
@PLACEBOBRO
Copy link
Author

Thank you for your fast answer. Then I missunderstood how some things work haha.

@PLACEBOBRO
Copy link
Author

PLACEBOBRO commented Jan 15, 2025

I have to reopen the issue.
I have done the steps to create my container with content blocks. However I'm having the same issue as mentioned above.
Here is my container config:

name: bt/container-1col
typeName: container-1col
group: container
prefixFields: false
fields:
  - identifier: bt/palette_header
    type: Basic

The palette_header configuration is the same as above

@nhovratov
Copy link
Contributor

Please come to Slack if you need support. GitHub is not the right place.
This looks correct from my side. Maybe you have some TCA override left or something I don't know.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Support Support on how to use functionalities
Projects
None yet
Development

No branches or pull requests

2 participants