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.

Comments

benjifisher’s picture

Status: Active » Needs review
StatusFileSize
new197.1 KB

No, "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:

screenshot of /admin/structure/types/manage/ptoc_page/fields/node.ptoc_page.field_ptoc_sections

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. ...)

kirkilj’s picture

Thanks Benji, I haven't had sufficient coffee to wrap my head around your reply, but I will tomorrow.

kirkilj’s picture

Forgive 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?

benjifisher’s picture

... you have a field with machine_name=field_ptoc_section on both the "Page with Sections" as well as the Bundle paragraph type

Almost. Those are actually two different fields with the same machine name. If you look in the config/install/ subdirectory of the module, you will see field.storage.node.field_ptoc_sections.yml and field.storage.paragraph.field_ptoc_sections.yml. Or look at the field list (/admin/reports/fields): you will see two rows with field name field_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.)

Is there anything special about the Bundle paragraph type? Could I simply add the field_ptoc_section field to another container paragraph type?

No and yes.

kirkilj’s picture

Is 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?

benjifisher’s picture

Yes, it could have been called "container" or "collection" instead.

kirkilj’s picture

Thanks. 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.

benjifisher’s picture

Category: Support request » Task
StatusFileSize
new9 KB

@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_bundle to ptoc_collection.

  • benjifisher committed f26aaf2 on 8.x-1.x
    Issue #2856462 by benjifisher, johnkirkilis@gmail.com: Bundles =...
benjifisher’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.