cu-uis / cu-starterkit-project

Development repository for Pantheon's recommended (future) Drupal 9+ upstream
1 stars 2 forks source link

Feature Preview - Add module to declare a more advanced Paragraph #13

Closed kreynen closed 2 years ago

kreynen commented 2 years ago

Is your feature request related to a problem? Please describe.

There are a number of modules that declare Paragraphs like https://www.drupal.org/project/bootstrap_paragraphs, but there is currently no easy was to add the existence of a Paragraph Type to the list of Paragraphs a field on a content type supports. https://github.com/cu-uis/cu-starterkit-project/blob/master/web/modules/custom/cusys_layout_paragraphs/config/install/field.field.node.page.field_content.yml#L25 defines the a Paragraph Layout field on the Basic Page Content Type, but it can only allow the Paragraphs that it defines and/or exist when the field is added to the Content Type. Attempts to install the configuration for field.field.node.page.field_content.yml again in another module will fail.

Describe the solution you'd like

Ideally we'd have a way to declare that a Paragraph is intended to be added to the available Paragraph options.

Describe alternatives you've considered

MVP is just to define the process of enabling a new Paragraph Type.

kreynen commented 2 years ago

I added a Webform Paragraph as cusys_webform_bundle. I'm not sure if we should actually stick with the bundle pattern for optional feature groups, but it works for now. We've already discussed the issue of not being able to add paragraphs to the list of available paragraphs once the Paragraph Layout field on a content type is created. cusys_layout_paragraphs adds that field, so an additional manual step is required.

Screen Shot 2022-03-16 at 7 42 46 AM

It's also worth noting that Webforms are not rendered in the Preview.

Screen Shot 2022-03-16 at 7 46 04 AM
meschenbaum commented 2 years ago

Another option for having other paragraphs types be added is to reverse the setting for the field on allowed paragraphs. Currently we have it restricted to only allow those that are selected. We can change it to allow all paragraph types except those listed. it may add a little more flexibility but may/may not help with future paragraphs.

It may be easier to use a module update to add those that should be disallowed than those that should be allowed.