Problem/Motivation

Currently, if you enable the module, none of the available paragraphs are allowed. So you're forced to click through all the layouts and enable all the paragraphs or otherwise editors will not be able to add content anymore. Assuming one would only restrict paragraphs for "Layout X" he'd still be forced to check all the other layouts as well.

Proposed resolution

To avoid this situation it would be helpful to allow all paragraph types if none are selected.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

waluigi created an issue. See original summary.

waluigi’s picture

Title: Allow all paragraph types if none is selected » Allow all paragraph types if none are selected
waluigi’s picture

So I created a patch for this. One problem I faced was that you could choose the paragraph type that was chosen as the layout bundle. When either manually allowing that or now in this case it gets allowed because none others were selected, an illegal choice error popped up.

So to avoid both cases, I filtered the layout bundle out of the available paragraphs.

I'd appreciate any testing, thanks in advance :)

waluigi’s picture

Status: Active » Needs review
InaW’s picture

Status: Needs review » Needs work

I tested your patch. The patch works fine if I use a layout with only one region or if I have a layout with multiple regions and I don't allow any paragraphs for all the regions.
In a layout with multiple regions, if I allow some paragraphs for the first region and for all other regions I don't choose any paragraphs, then none of the available paragraphs are allowed for these regions. I assume that the correct behavior should be, that all available paragraphs should be allowed for a region where no specific paragraphs were selected in the widget for this region.

waluigi’s picture

Thanks @InaW for the feedback. I did that intentionally because when a user changes something in these settings, he is aware of where and how to change things.
Enabling all paragraphs for each region if none of this region is selected is a bit too much in my opinion because one possibly want to ban all paragraphs from a layout (e.g. if you want to use it as space).

So my approach now is to check it per layout. Doing so, you are still able to deactivate a whole layout in the field settings.
What do you think?

InaW’s picture

Status: Needs work » Reviewed & tested by the community

Thanks @waluigi for your work. I really like your approach that you define it per layout/section. I think this is a good solution and I assume that it's easy for the user to understand how to use it. I tested it with multiple Layouts and it works fine. Well done!

  • waluigi committed 45b5c7b on 8.x-1.x
    Issue #3087079 by waluigi, InaW: Allow all paragraph types if none are...
waluigi’s picture

Version: 8.x-1.0-alpha1 » 8.x-1.x-dev
Status: Reviewed & tested by the community » Fixed

Thanks a lot for testing and your feedback :) It is on dev now.

Status: Fixed » Closed (fixed)

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