Score:2

Add ThirdPartySettings to individual paragraphs of a certain bundle?

in flag

I want to add configuration settings to Paragraph entities in a specific bundle in Drupal 8. Theres potentially a lot of options and the need to change/update them over time, so I figure the best way is through ThirdPartySettings and not adding more fields to it. I am going to use these values to influence certain aspects of the render and for search queries.

I can see where you can add settings to the bundle itself, but how do you provide them for each paragraph instance on a node via a config schema?

I see this in the Paragraphs config schema dir:

paragraphs.paragraphs_type.*:
  type: config_entity
  label: 'Paragraphs type config'
  mapping:
    .....

But paragraphs.paragraphs_type.*.third_party.foo... would add it to the bundle, right?

4uk4 avatar
cn flag
Yes, it's like Layout Builder stores per-view-mode settings as third party config and per-node-settings as field content. What you are trying to do is the same for Paragraphs.
Score:1
cn flag

A paragraph is a content entity, which doesn't support third party settings. Third party settings are just for config entities.

The solution is just to use fields, awkward as it might seem.

Kevin avatar
in flag
Ah damn. It would be nice in this case to avoid fields, +2 tables, etc. I guess its the only route for now.
cn flag
Yeah, feel your pain, I was in a similar position a couple of months back but with Layout Canvases
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.