Based on the functionality, I'm assuming that the paragraph type called "Bundle" is a section (as shown in the editing interface). Is there a reason these are different? I could be missing an important distinction.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 2856462-dont-overload-bundle-9.patch | 9 KB | benjifisher |
| #2 | sections-settings.png | 197.1 KB | benjifisher |
Comments
Comment #2
benjifisherNo, "Sections" is the label for
field_ptoc_sections, which is a field on the "Ptoc page" content type. (You can use the field on other content types, but see the instructions in the README.) This is a multi-valued field of references to Paragraphs, and the default configuration from this module is that those paragraphs can be any of the types defined by this module. Like this:One of the Paragraphs types defined by this module is "Bundle" (
ptoc_bundle) and one of the fields on this type is "Subsections" (field_ptoc_sections), another multi-valued field of references to Paragraphs.The difference between "Sections" and "Subsections", which have the same machine name, is that "Sections" can be added to content types and "Subsections" can be applied to Paragraphs types. In Drupal 8, a field can only be added to a single type of entity.
If these names are confusing, then it is not too late to change them! I already changed several of the machine names between the alpha1 and rc1 releases. I could make further changes and then make an rc2 release. Can you suggest names that would be clearer?
Also, have a close look at the screenshot on the project page. The page has three paragraphs in the "Sections" field: "More description?", "My first bundle", and "My second bundle". Each of the two bundles has two "Subsections". (This reminds me of the old riddle: On the way to St. Ives, I met a man with seven wives. ...)
Comment #3
kirkilj commentedThanks Benji, I haven't had sufficient coffee to wrap my head around your reply, but I will tomorrow.
Comment #4
kirkilj commentedForgive me, but I'm still confused. You mentioned that "In Drupal 8, a field can only be added to a single type of entity", you have a field with machine_name=field_ptoc_section on both the "Page with Sections" as well as the Bundle paragraph type. One is a content entity type and the other is a paragraph entity type, so are these not the same field attached to different entity types?
Is there anything special about the Bundle paragraph type? Could I simply add the field_ptoc_section field to another container paragraph type?
Comment #5
benjifisherAlmost. Those are actually two different fields with the same machine name. If you look in the
config/install/subdirectory of the module, you will seefield.storage.node.field_ptoc_sections.ymlandfield.storage.paragraph.field_ptoc_sections.yml. Or look at the field list (/admin/reports/fields): you will see two rows with field namefield_ptoc_sections. (It would be nice if that page indicated the entity type for each field. If you know what you are looking for, you can hover over the links in the "Used in" column and figure it out.)No and yes.
Comment #6
kirkilj commentedIs there any special relationship between the meaning of the term "bundle" as it pertains to the PTOC paragraph type and the general Drupal "bundle"? Aren't all paragraph types Drupal bundles at some level? Could it have been called a "container" or "collection" just as easily?
Comment #7
benjifisherYes, it could have been called "container" or "collection" instead.
Comment #8
kirkilj commentedThanks. Overloading the name of a key Drupal concept, such as bundles, may be inviting confusion and a lot of similar questions.
This module was a key part of a proof-of-concept demo to keep Drupal in the running for a new project.
Comment #9
benjifisher@johnkirkilis@gmail.com, that is a good point about overloading the term "bundle". I think it is worth doing this even without that reason, if it will help avoid confusion.
I have attached a patch that applies on top of the one for #2865778: Make it easier to delete paragraph types, changing the label from "Bundle" to "Collection" and the machine name from
ptoc_bundletoptoc_collection.Comment #11
benjifisher