Code Monkey home page Code Monkey logo

Comments (8)

nhovratov avatar nhovratov commented on August 21, 2024

Yes, we could also think about adding this as a feature. Grouping content elements is a common task and should be easy as well. Falling back to TsConfig removes the benefit of having everything in the Content Block. Not sure how this would look like though.

from content-blocks.

nikonierer avatar nikonierer commented on August 21, 2024

This is a feature request that also came up for me recently, while working on the first real-life projects with Content Blocks in use.

Without any thoughts about the implementation yet, my first idea would be that a group is automatically created with the key as the label when it is used in a Content Block for the first time and content elements with this group set in the configuration are checked for a label within a defined schema for the translation key, where either the first or last definition wins?
This would make it possible to define a group in a content block, copy it and it would work out-of-the-box without having to worry about whether other outer requirements are fulfilled for this content element to be fully functional. Hope it's understandable what I want to point out. ;)

Looking forward to any feedback on this approach and please let me know if I can help in any way.

from content-blocks.

nhovratov avatar nhovratov commented on August 21, 2024

While I like the idea to also isolate adding new groups within a Content Block, I feel like this should be defined outside. The reason is that most of the time you maybe add 1 or 2 more groups in addition to the default one. It would be too much redundance even for Content Blocks. Changing the label for a group would be painful.

Idea:
We could add another Folder "Groups" where you can place a yaml file, which contains a list of group ids. Next to it there is a Labels.xlf file with a pre-defined schema like for fields.

ContentBlocks
  ContentElements
  ...
  Groups
    Groups.yaml
    Labels.xlf

Groups.yaml

- group1
- group2
...

Labels.xlf

<trans-unit key="group1.label">
...
<trans-unit key="group2.label">
...

from content-blocks.

krausandre avatar krausandre commented on August 21, 2024

What I think about it: A new directory for such a little feature sounds really expensive to me. I stumbled upon it by myself, and so I understand the need. On the other hand, it is really really easy is to do it the "old" way. So I come to the conclusion, it would be nice to have, but if we implement it, we need something smooth. I have something in my mind like:

// EditorInterface.yaml

// if group property is string, just add it to the group
group: common
// but you can register a new group via an "array"
group:
  -
    newgroup1: "My first group"
  -
    newGroup2: "LLL:EXT:sitepackage..."
  // if label is empty, look in the Labels.xlf for key group.newGroup3:
  -
    newGroup3

I havenโ€™t thought it through, but maybe this could be an approach...
With an array, you are able to add the content block to multiple groups. (eg. common and interactive)
In normal cases, you should "register" only the groups, in which the content block appears.
One more reason to do it in a content element is IMHO, that this is "content element only" thing.

from content-blocks.

nhovratov avatar nhovratov commented on August 21, 2024

On the other hand, it is really really easy is to do it the "old" way.

Yes, this is true. That's why I hesitated so long to tackle this issue at all.

With an array, you are able to add the content block to multiple groups.

Huh, I didn't thought about that at all. Never seen this someone do, though.
Also, there is the possibility to set default values per Wizard entry. So an element could be registered multiple times in different groups + with different default values.
In addition, you can also set before:group1 and after:group1 in TsConfig.

One more reason to do it in a content element is IMHO, that this is "content element only" thing.

Well, right now this is true. There is a WIP patch right now to unify Wizard groups and TCA type select groups: https://review.typo3.org/c/Packages/TYPO3.CMS/+/73488
With this it would be possible to also group PageTypes and RecordTypes (at least in the TCA type select field).
There are some unresolved issues though.

from content-blocks.

krausandre avatar krausandre commented on August 21, 2024

Huh, I didn't thought about that at all. Never seen this someone do, though.

Look at bootstrap_package: you will find e.g. textpic in the groups common, media, and text. For me it make sense, because someone could search it there. (At the newContentElementWizard)

Also, there is the possibility to set default values per Wizard entry. So an element could be registered multiple times in different groups + with different default values.

Didn't know that before. This is crazy and amazing, but what I found out is, the more possibilities editors have in the newContentElementWizard, the more they are confused.

from content-blocks.

nhovratov avatar nhovratov commented on August 21, 2024

In v13 this needs to be called to add a group.

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItemGroup(
    'tt_content',
    'CType',
    'content-blocks-custom',
    'My label'
);

from content-blocks.

jonaseberle avatar jonaseberle commented on August 21, 2024

We talked about it:
We are not planning to support the creation of custom groups. We don't see a benefit doing it in YAML.

Internal code:
We'd like to use the new TCA-way https://review.typo3.org/c/Packages/TYPO3.CMS/+/73488 instead of the current TSConfig way for adding our CType to a group.

from content-blocks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.