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

Reuse RecordType in Collection and enforce type #101

Open
nhovratov opened this issue Jan 26, 2024 · 3 comments
Open

Reuse RecordType in Collection and enforce type #101

nhovratov opened this issue Jan 26, 2024 · 3 comments
Labels
Discussion Gather different opinions on a topic enhancement New feature or request

Comments

@nhovratov
Copy link
Contributor

nhovratov commented Jan 26, 2024

-
  identifier: relations
  type: Collection
  foreign_table: tx_dsboilerplate_contentblockrelation
  shareAcrossTables: true
  shareAcrossFields: true
  overrideChildTca:
    columns:
      type:
        config:
          default: dsboilerplate_linktiles_test
          readOnly: true
  foreign_match_fields:
    type: dsboilerplate_linktiles_test
-
  identifier: relations2
  type: Collection
  foreign_table: tx_dsboilerplate_contentblockrelation
  shareAcrossTables: true
  shareAcrossFields: true
  overrideChildTca:
    columns:
      type:
        config:
          default: dsboilerplate_linktiles_test2
          readOnly: true
  foreign_match_fields:
    type: dsboilerplate_linktiles_test2

Screenshot 2024-01-26 at 21-41-13 Edit Page Content No title on page Home · Content Blocks TYPO3 CMS 12 4 10

@nhovratov nhovratov added enhancement New feature or request Discussion Gather different opinions on a topic labels Jan 26, 2024
@nhovratov
Copy link
Contributor Author

Interesting use case came up in Slack. The user wanted to reuse a RecordType with 2 different variations. The type should be automatically set in context to the Content Block it is used in. This is possible, however it requires a lot of boilerplate code.

Option 1: Document this specific use case as a guide article.
Option 2: Allow to use this logic with a shortcut and only document the easy way. E.g.: enforceType: typeA

@nhovratov
Copy link
Contributor Author

For reference, I used the foreign_match_fields method from TCA: https://docs.typo3.org/m/typo3/reference-tca/main/en-us/ColumnsConfig/Type/Inline/Properties/ForeignMatchFields.html

@nhovratov
Copy link
Contributor Author

todo: evaluate if we could provide type restrictions like in Mask: https://github.com/Gernott/mask/blob/main/Classes/ItemsProcFuncs/CTypeList.php

This is of course really hacky. Maybe this could be a Core feature instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Gather different opinions on a topic enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant